Skip to content

Instantly share code, notes, and snippets.

@Raynos
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save Raynos/11394082 to your computer and use it in GitHub Desktop.

Select an option

Save Raynos/11394082 to your computer and use it in GitHub Desktop.
// foldp := (Signal<A>, (B, A) => B, B) => Signal<B>
function foldp(source, lambda, initial) {
var result = Signal(initial)
source.listen(function (ev) {
result.set(lambda(result.get(), ev))
})
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment