How to encode corecursion/codata in a strictly evaluated setting?
问题 Corecursion means calling oneself on data at each iteration that is greater than or equal to what one had before. Corecursion works on codata, which are recursively defined values. Unfortunately, value recursion is not possible in strictly evaluated languages. We can work with explicit thunks though: const Defer = thunk => ({get runDefer() {return thunk()}}) const app = f => x => f(x); const fibs = app(x_ => y_ => { const go = x => y => Defer(() => [x, go(y) (x + y)]); return go(x_) (y_)