Interesting: "Lisp as a competitive advantage"

Alan Bawden Alan@LCS.MIT.EDU
Thu, 3 May 2001 16:25:45 -0400 (EDT)


(Drat.  Sorry for the duplicate message.  I just learned a new Emacs
keystroke by accident...  Ever notice how you never make a mistakes like
that unless the audience is very large?)

   Subject: Re: Interesting: "Lisp as a competitive advantage" 
   Date: Thu, 03 May 2001 10:16:37 -0400
   From: Norman Ramsey <nr@eecs.harvard.edu>

    > http://www.paulgraham.com/paulgraham/avg.html
   ...
   When I compare Lisp and Haskell, the big question in my mind is this:
   is lazy evaluation sufficient to make up for the lack of macros?

   I would love to hear from a real Lisp macro hacker who has also done
   lazy functional progrmaming.

The answer is: "almost".  Simply having higher order functions eliminates a
lot of the need to macros.  Common Lisp programmers could probably use a
lot fewer macros than they do in practice.  Lazy evaluation eliminates
the need for another pile of macros.  But there are still things you
need macros for.  

Here's a macro I use in my Scheme code all the time.  I write:

  (assert (< x 3))

Which macro expands into:

  (if (not (< x 3))
      (assertion-failed '(< x 3)))

Where `assertion-failed' is a procedure that generates an appropriate error
message.  The problem being solved here is getting the asserted expression
into that error message.  I don't see how higher order functions or lazy
evaluation could be used to write an `assert' that behaves like this.