The big thing Lisp has that Ruby can't do is code-as-data. I wish I could provide a good example of how that might be used practically, but it's been quite a while since I touched lisp. Devin Joe Van Dyk wrote: >Whoops, this belongs on ruby-talk... Sorry. > >---------- Forwarded message ---------- >From: Joe Van Dyk <joevandyk / gmail.com> >Date: Sep 26, 2005 6:20 PM >Subject: Lisp macros >To: rails / lists.rubyonrails.org > > >So, I'm diving into a little bit of Lisp, using >http://www.gigamonkeys.com/book/ as a starting point. > >Lisp's big selling point is macros, right? I'm only up to chapter 3, >but from that (maybe very basic?) display of macros, it looks like >something that can be done in Ruby. > ><excerpt> >(defun make-comparison-expr (field value) > `(equal (getf cd ,field) ,value)) > >(defun make-comparisons-list (fields) > (loop while fields > collecting (make-comparison-expr (pop fields) (pop fields)))) > >(defmacro where (&rest clauses) > `#'(lambda (cd) (and ,@(make-comparisons-list clauses)))) > >CL-USER> (macroexpand-1 '(where :title "Give Us a Break" :ripped t)) >#'(LAMBDA (CD) > (AND (EQUAL (GETF CD :TITLE) "Give Us a Break") > (EQUAL (GETF CD :RIPPED) T))) >T > > >You could use eval + procs to do that, right? > >Joe > > > >