Hi,
I'm prototyping a source translation framework in Clojure and I've run
across a problem. I have a bunch of files with s-expression data and
I'd like to define my own macro expanders for that data, like this:
(defmacro defexpander [sym args & body]
`(let [fun# (fn ~args ~...@body)]
(add-expander! '~sym fun#)))
(defexpander foo [tree] `(+ ~@(rest tree) +)) ;;; (foo bar) -> (+ bar
+)
add-expander! is a function that squirrels away the symbol-expander
mapping for future use when the transformations are being run.
Now much to my confusion, the syntax-quote operator doesn't produce a
list, but a cons, with symbols resolved. I assume this was to simplify
macro handling internally within Clojure?
Is there a way to do a proper list quasi quote exansion? Currently I
have to write
(defexpander foo [tree] (list '+ (rest tree) '+))
which just doesn't scale beyond simple expressions.
Thanks,
Andreas
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en