18:58: rhickey: ah, local macros like CL macrolet, and symbol-macrolet
- nope, don't have those yet
That's from: http://clojure-log.n01se.net/date/2008-06-19.html
Not much to on, is it? :-)
> I was trying to re-write the macro `..' in terms of reduce, and here's
> what I came up with. (Am I wrong in assuming that in this case a
> (sub) macro is required to keep `call' from being evaluated? Is there
> some better way of doing this while still using reduce?)
>
> (defmacro doubledot [obj & calls]
> (defmacro make-dot [callee call] `(. ~callee ~call))
> (reduce make-dot obj calls))
I don't think you need a sub-macro at all:
(defmacro doubledot [obj & calls]
(reduce (fn [callee call] (list `. callee call)) obj calls))
or:
(defmacro doubledot [obj & calls]
(reduce (partial list `.) obj calls))
--Chouser