I've been wondering how you can extract the SKI combinators out of Nock.
We've already seen that [0 1]
is the identity operator I. So Ix is *[x [0 1]]
.
Turns out K and S are simple:
Recall Kxy = x. i.e. Kx is a function that takes y and returns x. Sounds a lot like *[y [1 x]]
.
Sxyz = xz(yz). S takes three arguments and then returns the first argument applied to the third, which is then applied to the result of the second argument applied to the third. Sounds a lot like *[*[z y] *[z x]]
which is *[z 2 y x]
.