Cool. A cons pair implemented as a closure. cons(a, b) returns a function closing over a and b, which takes a function as argument, and calls it on a and b.
I've seen object systems done as closures. In most languages, a closure can modify its state, so it's an interesting way to close over that state, in a way that is invisible introspection by any other means but the published interface (or a debugger that understands the closure representation).
@billstclair@Absinthe Except they do. Partial computation and first-class functions are the bedrock of most asynchronous programming (i.e., most Web content.)
CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.
re: Solution
No use except to illustrate the power of closures. Nobody would build a real system that way.