[Haskell-cafe] TT check

Andrew Coppin andrewcoppin at btinternet.com
Sun Jul 1 13:26:18 EDT 2007

Can somebody check that I've implemented this correctly?


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?

More information about the Haskell-Cafe mailing list