[SOLUTION] Lisp Game (#49)

This was an interesting one.

I started out trying to do a fairly word-for-word translation to ruby,
and then started on a loose translation after I hit the defmacro stuff.

Then I thought, screw that. Why not parse LISP? I think ended up getting
a much better understanding of all the bits that the casting SPELS
article glossed over.

Herein, an extremely inelegant, and potentially severely broken lisp
processor.

It allows you to write code like the following:

require 'lisp'
class Monkey
  include Lisp
  include Lisp::StandardFunctions
  def boogers
    "Monkeys!!"
  end
end

x = Monkey.new
x.lisp "(setf *something* 'value)"
x.lisp "(defun saysomething () *something*)"

x.saysomething()
=> "value"
x.lisp "(saysomething)"
=> "value"
x.lisp "(boogers)"
=> "Monkeys!!"

lisp.rb (19.8 KB)

quiz_49_lisp.rb (953 Bytes)

ยทยทยท

#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################