On 11/2/2010 12:38 PM, Laurent PETIT wrote:
2010/10/30 Tim Daly<d...@axiom-developer.org>:
Macros in lisp get used for three general purposes, at least
in my experience.
The first purpose is efficiency. In common lisp you will find
that you can generate very machine-efficient (aka optimized
fortran level) binary instruction sequences if you add type
information. This gets tedious to do in code so you write a
macro. So (+ x y) has to assume that x and y are anything,
including non-numeric. If you write a (plus x y) macro it
can expand to
(the fixnum (+ (the fixnum x) (the fixnum y)))
which I have seen optimized into a single machine instruction.
Macros could be used to solve the boxing/unboxing issues in
Clojure.
For writing DSLs, consider the excellent speak of cgrand at the conj :
(not= DSL macros)
Here are the slides: http://speakerrate.com/talks/4895-not-dsl-macros
Yes, I saw the slides. I disagree with the speaker, at least, from
what I could see from the slides.
Tim Daly
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en