re: Solution 

@Absinthe

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.
Follow

re: Solution 

@billstclair yep, that is what it seems. But what is the use/benefit of this technology?

re: Solution 

@Absinthe

No use except to illustrate the power of closures. Nobody would build a real system that way.

re: Solution 

@billstclair I am not sure I am seeing what power they are trying to illustrate...

re: Solution 

@Absinthe

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).

re: Solution 

@billstclair @Absinthe Except they do. Partial computation and first-class functions are the bedrock of most asynchronous programming (i.e., most Web content.)
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.