2 ms·
Yeah, the answer is a bit beyond the scope of a HN comment but it kind of boils down to clever representations for the values zero, n+1, true and false, etc. Ef
by steamer25 15y ago
Yeah, the answer is a bit beyond the scope of a HN comment but it kind of boils down to clever representations for the values zero, n+1, true and false, etc. Effectively, any real number is represented as 0+1+1+1+1+1+... E.g., You can compare two numbers (less than, greater than, equal to, etc.) by decrementing them simultaneously and seeing which arrives at zero first (which requires recursion, an isZero function and boolean values for the result), etc. It's very similar to deriving Lisp as in The Little Lisper or The Little Schemer.
The execution of such a program on an actual "Turing machine" probably wouldn't be as performant as on our modern complex-instruction-set processors. Then again, I think the intent is to think of it as executing at the same speed at which a mathematical equation is true. I.e., You could go out and count 999 things or just accept that nine nine nine is a concise symbol representing the same procedure. The SKI representation isn't as terse but it's still just a symbol.
You can also read more at http://en.wikipedia.org/wiki/Lambda_calculus#Encoding_datatypes http://en.wikipedia.org/wiki/Lambda_calculus#Encoding_dataty... ...though it doesn't seem as gentle (read hand-holdingly verbose) as To Mock a Mockingbird.