Crazy J/Empty output
Jump to navigation
Jump to search
Crazy J examples
Simplest example - program which ignores its input and prints nothing
Lambda calculus expression of the program:
λ input . λ f . f 257 ? (where ? is anything we like since no one looks there anyway)
We have to get rid of input somehow since there's no K combinator to destroy it. The simplest thing that can be done is to sweep all dust under the carpet beyond EOF. So, we have:
λ input . λ f . f 257 input =
... just rewrite ...
= λ input f . f 257 input =
... let's introduce V = λ x y z . z x y ...
= λ input f . V 257 input f =
... eta-reduce ...
= V 257
Church numeral 257 can be expressed as 256+1, whereas 256 = 4 4 = M 4.
Finally, replacing V and 257 with their IJ expressions, we get:
````j``j```jii`j`j``jii``jiiij```````j`j````jjii`j`j``jiii`j```jjiijj```j``jii``ji``jii`j`j``jii````j```jii```j``ji```ji``j``jiiii```jjii``j`jijii``jii
This program does nothing at all!