Understanding the Y-Combinator with Racket

Understanding the Y-Combinator seems to be one of the functional programming right-of-passage things, and for good reason, it is fun. Not all of the articles out there spoke to me, so I took notes while coding it up in a way that I understood it.

My notes are attached in the form of a Scribble here How the Y Works, viewable here, and the source code version here y.

It is Racket, but it is really close to Scheme and if you wrote a couple of macros it would probably run on Clojure pretty easily.

The goal is for there to be no gaps in the code, it should be pretty obvious how each step was taken. Hand-coding it made it clear what was happening. This is what worked for me :).


One thought on “Understanding the Y-Combinator with Racket”

Leave a Reply

Your email address will not be published. Required fields are marked *