Comment

Comment by tromp

    let A = (x) => (y) => (z) => x(z)(y((w) => z))
Just need to combine this a few times.

    let K = A(A(A))(A(A(A))(A)(A)(A)(A)(A); // (x) => (y) => x
    let S = A(A(A(A)(A(A)(A(A)))(A(A(A(A)((A(A)))))))(A)(A); // (x) => (y) => (z) => x(z)(y(z))
> “I would never be caught dead using Lambda calculus. It’s a bloated language.”

Actually, combinatory logic is more bloated than lambda calculus, generally needing more bits to express the same program [1]. One can argue that lambda calculus is one of the most concise languages ever [2].

> Dana smirks. “Well, yeah. JavaScript is an eager language. Can’t use the Y combinator.”

Eager languages can be made lazy by wrapping arguments in lambdas with dummy arguments, as done in the Javascript BLC interpreter [3].

[1] https://tromp.github.io/cl/LC.pdf

[2] https://www.ioccc.org/2012/tromp/

[3] https://github.com/tromp/AIT/blob/master/uni.js#L56

parent tromp 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton