Python implementation of chapters 9, 10 of Daniel Friedman's "Little Schemer"
Chapter 9 described how to construct the Y Combinator, which in Python looks pretty nice:
Y = lambda le: (lambda f: f(f))(lambda f: le( lambda x: f(f)(x)))
Chapter 10 includes a smol Lisp interpreter, which fully support the Y combinator, albeit in unparsed abstract-syntax-tree form for now:
Y = ['lambda', ['le'], [['lambda', ['f'],['f','f']],['lambda', ['f'], ['le', ['lambda', ['x'], [['f', 'f'], 'x']]]]]]
- Parser to turn normal Lisp into the AST
- Compare this minimal Lisp implementation to the one described in http://www.paulgraham.com/rootsoflisp.html