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
.



Relevant Pages

  • Re: SBCL is now faster than Java, as fast as Ocaml, and getting better
    ... make Lisp look less stupid. ... you just defined programmers who cite superfluous ... The creators of the ML family of languages ... consider what it takes to create a "fresh compiler" when the ...
    (comp.lang.lisp)
  • Re: OT (slightly) What is the "best" processor for a new project?
    ... Lisp influence on Python, Ruby, Javascript, and even Java is huge. ... the "agile" process does not work well for languages with separate ... some object, which, when freed, will free the corresponding strings, ... E.g. take the hardware accellerated video player: ...
    (comp.lang.forth)
  • When static typing is worth it
    ... typed languages like Lisp. ... developed more quickly in modern statically typed languages than ... static type system and remove run-time checks. ... incurs a run-time error if the list is ...
    (comp.lang.lisp)
  • Re: Chestnut Lisp translator
    ... Can't say, but superficially there's a big, clear difference in syntax ... between the lisp family and what most programmers will have seen before: ... and it also doesn't fit with that collection of languages. ... Maybe we need a text along the lines of "lisp for programmers from the ...
    (comp.lang.lisp)
  • Re: What is Lisp used for?
    ... My main languages are Perl, Java, and ColdFusion. ... Lisp PHP FlamingThunder). ...
    (comp.lang.lisp)