I should clarify: I asked my original question not because I wanted to
actually write an optimiser but rather I was interested in how far the
idea of code-modifying code could be pushed in a Lisp-like language
such as Clojure. The example I gave was just the simplest thing I
could think of that demonstrated what I was imagining.

Basically, I wanted a little exercise to try to understand macro
programming better and though this would be a fun exercise. I just
didn't know where to start. Stuart's template is more or less what I
was after.

Konrad, I agree, it would make more sense to add simple optimisations
like the one for addition to Clojure itself. However, the potential
problem you mention regarding the clash of multiple definitions of `+`
doesn't seem like that big an issue since an optimising macro can just
call `resolve` against the first symbol and see if it is equal to
`clojure.core/+`. Paul's suggestion also seems to get around this
problem.

Thanks for all the responses.

Mark
--
http://mark.reid.name
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to