Church Numerals in ski by hinoe(rst76)

data E=E:$E|T Char|U
m@main=getLine>>=print.e.foldr(!)[]>>m
'`'!(x:y:z)=x?y:z
x!y=T x:y
_:$x:$y?z=x?z?(y?z)
T 'k':$x?y=x
T 'i'?x=x
x?y=x:$y
e[a]=c$a?U?U
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