Created
December 10, 2016 15:02
-
-
Save xaviervia/bc0b31bcf940e4d667db3423859bedb4 to your computer and use it in GitHub Desktop.
zazen.cell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Input = any | |
type EffectCell = { | |
lastInputs: Array<Input>, | |
computation: (inputs: Array<Input>) => Array<Input>, | |
effect: (inputs: Array<Input>) => void, | |
dependants: Array<Cell> | |
} | |
const computation0 = Cell() | |
const computation = Cell() | |
computation0.dependants.push(computation) | |
const updatedCompuntations = dirtyCheck(computations, newInputs) | |
runCell(updatedCompuntations) | |
let computation | |
computation = update(computation, 1, 2, 3) | |
computation = update(computation, 7, 8, 9) | |
computation = update(computation, 7, 43, 9) | |
computation = update(computation, 1, 2, 3) | |
dirtyCheckAndRun(computation, prevComputation) | |
---- | |
el0 -> c(5) -> {lastInputs: [5]} -> effect // effectful | |
el1 -> c(6), c(7), c(5) -> {lastInputs: [5]} -> effect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment