Skip to content

Instantly share code, notes, and snippets.

@aziis98
Last active January 15, 2018 00:43
Show Gist options
  • Select an option

  • Save aziis98/2b3bb3f508460576e1829235086a109e to your computer and use it in GitHub Desktop.

Select an option

Save aziis98/2b3bb3f508460576e1829235086a109e to your computer and use it in GitHub Desktop.

DDMath

Drag and Drop mathematics, features:

  • drag a term and add/sub/mul/div from both sides
  • automatic/onclick expression simplificaiton
  • in case of "a * (b + c)", dragging "a" inside the parenthesis will let you distribute the term

Fragment Editor

Left/Right side:

Left Side

The composer is on the left and lets you plan the compilation/composing of the various pices of code Would play nicely with JavaScript and all the various merging/transpilation that happens there.

Possible nodes in the composer:

  • Fragment: a pice of code, maybe a single function or a class. Goal: keep file sizes small and managable
  • Cat: Joins the contents of various fragments together.
  • Processor: Transforms the content of the input into something else
  • Inputs: File/resource input
  • Outputs: Writes contents of input to a file

Node Types & Functions

core Data
core FilePath -- Holds a relative ref to a file
core DirectoryPath -- Holds a relative ref to a directory
core File -- Holds file name
core Directory -- Holds directory name

type Text is Data -- Holds text
type Image is Data -- Holds images

type Fragment is Text

Group<T> :: T... -> [T] -- Groups a list of input of type T in a single list of Ts

cat :: [Text] -> Text -- joins a list of text pices together
                      -- NOTE: automatic grouping of inputs, in practice a group is created automatically when a Text input is attached to this node.

type Processor<From is Data, To is Data> is [From] -> To

loadImage :: FilePath -> Image
loadImages :: [FilePath] -> [Image]

transpileTS2JS :: Processor<Text, Text> -- transpiles Typescript to Javascript

output<D is Data> :: (FilePath, D) -> .

forEach<T> :: [T] -> T -- Actually this is more profound than expected...
                       -- thinking of how filter could be implemented...

Right Side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment