Hello --

I am trying to gain a better understanding of Clojure's macro
language.

The output I am aiming for (and which is to be used as code in another
macro) is as follows:

{:a a :b b :c c :d d}

The attempt I made is as follows:

(defmacro tm [& args]
  `{~@(mapcat (fn [x] (list (keyword x) x)) args)})

Obviously, I am making a very basic mistake, because at the REPL I
get:

---
user=> (defmacro tm [& args]
  `{~@(mapcat (fn [x] (list (keyword x) x)) args)})
java.lang.ArrayIndexOutOfBoundsException: 1
java.lang.Exception: Unmatched delimiter: )
---

Any pointers are greatly appreciated.

Ingolf

-- 
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

Reply via email to