Re: A "killer" macro



Christophe <christophe.allegrini@xxxxxxxxxxxxxxxxxx> writes:

On 12 sep, 08:59, Eli Bendersky <eli...@xxxxxxxxx> wrote:
Hello all,

In short: I'm looking for a "killer" macro - a macro (or a couple of
related ones) that show what Lisp can do and other languages (those
without uniform syntax) can not.

A longer version: Many contemporary languages boast their sharing most
of the functional features of Lisp. Perl, Ruby, Javascript - all have
convenient lists (or arrays), functions as first class objects,
garbage collection, dynamic typing, lexical closures. However, one
thing they lack is uniform syntax, and hence the service of a powerful
built-in macro system such as Common Lisp's "defmacro".
When confronted by fellow programmers with the question "so why is
Lisp so special", I'm looking for that short - not too hard to
understand - snippet of code that will show them *why*. I'm convinced
that such a snippet must involve macros. But all the examples I ran
into so far have been either too simple - and could be easily
implemented another way (for example with Ruby's blocks), or too
complicated.

Any suggestions for such an example ?

Eli

Hello,

Quickly, Macro in Lisp is, in fact, a way to create your own domain
specific language.

No needs to search a long time : loop, iterate or defclass are smart
examples.

Seconded. The point is that a CL programmer can be pretty sure that he can
adapt CL to any new programming paradigm without hacking the CL
implementation, whereas in other languages this is often impossible. Tell
them to implement a full CLOS-equivalent (dynamic class changes, multiple
inheritance, multimethods) in their respective language. Then tell them
that this was possible in pre-CL-Lisp.

Nicolas
.