Skip to content

Instantly share code, notes, and snippets.

@xaviervia
Created December 10, 2016 15:02
Show Gist options
  • Save xaviervia/bc0b31bcf940e4d667db3423859bedb4 to your computer and use it in GitHub Desktop.
Save xaviervia/bc0b31bcf940e4d667db3423859bedb4 to your computer and use it in GitHub Desktop.
zazen.cell
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