On Sun, Sep 5, 2010 at 5:18 PM, Kent <squi...@aol.com> wrote:
> When clojure evaluates a piece of code it goes through several steps.
> First the reader takes the string representation of your code and
> turns it into the clojure data structures represented by your code.
> Those data structures are then sent to the compiler for compilation,
> including possible macro expansion.
>
> Your code contains {~@(mapcat (fn [x] (list (keyword x) x)) args)} in
> it.  The {} characters instruct the reader that this is a literal
> map.  The reader expects a literal map to have an even number of
> elements, which your code does not have.  It has one element.
> Therefore the reader throws an out of bounds exception.  The exception
> is being thrown by the reader (the bit that takes a string and turns
> it into clojure datastructures) BEFORE it ever gets to the point where
> it is trying to do a macro expansion.

Ah! because it really becomes {(unquote-splicing ...)} That makes sense.


> Note that {:a} by itself also throws an ArrayIndexOutOfBounds
> exception.
>
> K.
>
> --
> 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



-- 
http://www.apgwoz.com

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