Macros (Was: Interesting: "Lisp as a competitive advantage")

Michael Sperber [Mr. Preprocessor] sperber@informatik.uni-tuebingen.de
07 May 2001 10:53:44 +0200


>>>>> "Keith" == Keith Wansbrough <Keith.Wansbrough@cl.cam.ac.uk> writes:

Keith> Jerzy Karczmarczuk <karczma@info.unicaen.fr> writes:

>> Macros in Scheme are used to unfold n-ary control structures such as COND
>> into a hierarchy of IFs, etc. Nothing (in principle) to do with laziness
>> or HO functions.

Keith> Isn't this exactly the reason that macros are less necessary in
Keith> lazy languages?

Keith> In Haskell you can write

Keith>   myIf True  x y = x
Keith>   myIf False x y = y

Sure, but you're relying on pattern matching to implement the
semantics of myIf, which already is a generalized conditional.  In
Scheme, where pattern matching is not primitive, you can get it
through a macro.  The same holds for things like DO notation or list
comprehensions, where apparently lazy evaluation by itself doesn't
help implementing convenient syntax atop a more primitive underlying
notion.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla