Skip to content

Instantly share code, notes, and snippets.

@xaviervia
Created March 19, 2017 11:38
Show Gist options
  • Save xaviervia/17f533ada9bb8a2f0ca9ba0b066ff85c to your computer and use it in GitHub Desktop.
Save xaviervia/17f533ada9bb8a2f0ca9ba0b066ff85c to your computer and use it in GitHub Desktop.
const computationGraph = ComputationGraph([
x => x + 1,
[
x => x * 2,
x => x / 2
],
[
x => x + 10
]
])
const resultGraph = generateVoidResult(computationGraph)
/*
[
Right.of([undefined, undefined]),
[
Right.of([undefined, undefined]),
Right.of([undefined, undefined])
],
[
Right.of([undefined, undefined])
]
]
*/
const recomputeGraph = injectValueInRoot(resultGraph)(3)
/*
[
Right.of([3, undefined]),
[
Right.of([undefined, undefined]),
Right.of([undefined, undefined])
],
[
Right.of([undefined, undefined])
]
]
*/
const newResult = computationGraph(recomputeGraph)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment