Church Numerals in ski by rst76

data E=E:$E|T Char
m@main=getLine>>=print.c.head.foldr(!)(map T"10").("``"++)>>m
'`'!(x:y:z)=x?y:z
x!y=T x:y
T 's':$x:$y?z=x?z?(y?z)
T 'k':$x?y=x
T 'i'?x=x
x?y=x:$y
c(_:$x)=1+c x
c _=0

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page