News for hackers. Stuff that matters.
Re:Lisp in about 200 lines of Ruby by procrastitron on Sunday November 08, 2009 @05:57PM (#929965)
Well, lambda calculus is Turing complete, so you could just stick with a call-by-value version of that. However, you'd want to add macros if you wanted to extend the syntax of the language. Since you mentioned car and cdr in lambdas, they'd be defined like this:

NIL = (lambda (x) (lambda (y) y))

CONS = (lambda (ar) (lambda (dr) (lambda (op) (op ar dr))))

CAR = (lambda (expr) (expr (lambda (ar dr) ar)))

CDR = (lambda (expr) (expr (lambda (ar dr) dr)))

There are no comments on this comment yet.