Re: LISP macros vs Ruby procs ?
by Lith other posts by this author
Nov 6 2009 12:05PM messages near this date
Re: LISP macros vs Ruby procs ?
|
Re: LISP macros vs Ruby procs ?
> LISP's ` (the backtick) is roughly equivalent to Ruby's eval with a
> string, right?
That like saying a string is equivalent to an array/list. In lisp, a
macro can take the arguments transform it using the usual set of list-
related functions and generate the code for the macro. In scheme, you
can use some sort of structured pattern matching to generate the code.
> If there are any seasoned LISPers here, can you think of a sample LISP
> macro that can't be written in Ruby, to help me understand better?
I haven't written a single line in lisp for years but: Try to
implement lisp's loop form[1] or scheme's hygienic macros[2] in ruby
-- you're allowed to use only ruby 1.9 standard library.
[1] http://www.lispworks.com/documentation/HyperSpec/Body/m_loop.htm
[2] http://en.wikipedia.org/wiki/Hygienic_macro IIRC slib[3] contains
an implementation for older scheme interpreters.
[3] http://people.csail.mit.edu/jaffer/slib_toc.html
Thread:
Aldric Giacomoni
David Masover
Ryan Davis
Lith
Rick DeNatale
Lith
Aldric Giacomoni
Marnen Laibow-Koser
|