Oh, Lambda Calculus. The often touted ancestor of Lisp. The underpinning of most Functional languages. Two words to bust out at a dinner party in a vain attempt to sound smart in front of your fellow programmers 1.
At it’s most basic, Lambda Calculus states that all computations can be expressed in terms of two things: Functions and Function Application. In Ruby parlance these would be lambda { |x| x } expressions and Proc#call. That’s it 2. You’ve now expressed a Turing Complete language. Numerals? Yep. Arithmetic? You bet!.
So… neat.
While one can read in many places on the web as to what the Lambda Calculus is, as well as find ample implementations of it (usually in Lisps, no less), it can often all seem a bit magical and esoteric until one encounters it in a more familiar context 3.
Basically, this has all been posturing to set you up for Tom Stuart’s excellent Programming With Nothing, which does a much finer job of breaking all of this down than I could ever hope to, all in our beloved Ruby. If you have any interest at all, do yourself a favor and read the blog post, watch the video, and (attempt to) grok the code. It really solidifies that one is capable of most any computing operation after watching Tom implement fizzbuzz 4 with the tiniest subset of Ruby.
Surely one could write more on the subject, and perhaps in the future I’ll even produce some original content (how shocking!), but until then, I’ve hopefully at least pointed you to some of the excellent pre-existing resources on the topic.
ps: Maruku supports footnotes! I adore footnotes. If you don’t and I’ve beaten them to death in this article, please let me know. Until then, footnotes will continue to be abused.
-
One of two things tend to happen here, eyes will glaze over, or someone that knows more about it than you will dispel any wonder you once commanded.
↩ -
It’s even less clumsy in languages that don’t have a special case for function application. Scheme, Python, and even JavaScript. Yehuda Katz has written about Ruby Callables a handful of times and has some reasoned thoughts on it.
↩ -
If for some reason you find yourself more JavaScript inclined, or are just so deeply into the subject that you’d like more, you could do worse than read Matt Might’s Church encodings, the U combinator and the Y combinator in JavaScript.
↩ -
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
↩