Can somebody check that I've implemented this correctly?
*****X*X*X*XX***X*X*XXX*X*X*XX***X*X*X*XX**X*X*XX**X*X*X*XX
***X*X*XXX*X*X*XX**XX*X*XX***X*X*XXX*X*XX****X*X*X*XX****X*
X*X*XX***X*X*XXX*X*X*XXX*X*XXXX****X*X*XXX****X*X*X*XX***X*
X*XXX*X*X*XXX*X*XXXX
A parser for this is given by
decode (c:cs) = case c of
'X' -> X
'*' -> let (e0,cs0) = decode cs; (e1,cs1) = decode cs0 in (e0
`apply` e1, cs1)
The letter X stands for the following combinator:
X = \x -> xSK
K = \xy -> x
S = \fgx -> fx(gx)
Assuming my Haskell code is correct, the above *should* be a program to
compute the sum of the Church numberal 2 and the Church numeral 2. In
other words, this is the world's most verbose way to define the act of
putting two and two together. ;-) But... I don't know... that's A LOT of
expression there! Have a slipped up somewhere? Does anybody have a way
to check?