Skip to content

Instantly share code, notes, and snippets.

View MarkusPfundstein's full-sized avatar

Markus Pfundstein MarkusPfundstein

View GitHub Profile
const tailRec = (f) => (a) => {
let v = f(a)
while (!v.done) {
v = f(v.value)
}
return v.value
}
const done = (v) => ({ value: v, done: true })
const next = (v) => ({ value: v, done: false })