trampa
Trampolines, to emulate tail-call recursion.
Synopsis
var trampa = ; { return n === 0 ? trampa : trampa;} ; // doesn't cause stack overflow!
API
-
isTrampoline(t: obj): bool
— Returns, whethert
is a trampolined object. -
wrap(t: Trampoline a | a): Trampoline a
— Wrapt
into trampoline, if it's not already one. -
lazy(t : () -> Trampoline a | a)
— Wrap lazy computation into trampoline. Useful when constructing computations. -
Trampoline.jump(f : a -> b | Trampoline b)
— map or flatmap trampoline computation. Like.then
for promises. -
Trampoline.run(): a
— Run the trampoline synchronously resulting a value.
Changelog
- 1.0.0 — 2015-07-14 — Initial release