Oh sorry, were the colors off? Let's try this.

The map was actually unquoted. 'etal' (which was null) was unquote-spliced.
I excluded it for clarity:
*   user=> `(commands/add ~processed) *
*   result=> (<my-function> <my-map>) ;; ** first in this list is a function
*


Now, if I try to eval that, I get the said error.
*   user=> (eval `(commands/add ~processed))*
*   result=> java.lang.IllegalArgumentException: ...*


And I had tried macroexpand (here and in the containing function), and got
the same error:
*   user=> (macroexpand (eval `(commands/add ~processed)))*
*   result=> java.lang.IllegalArgumentException: ...*


You're right that the repl is using the map as a function. But I don't
understand why when 'commands/add' function was the first thing in the
return list. And macroexpand is yielding the same error . This is what had
me so perplexed. Hopefully this reads a bit better.

Thanks
Tim



On Tue, Apr 26, 2011 at 12:00 AM, Kevin Downey <[email protected]> wrote:

> sorry I cannot read your email
>
> On Mon, Apr 25, 2011 at 8:24 PM, Timothy Washington <[email protected]>
> wrote:
> > Hey Kevin, thanks for getting back to me.
> >
> > The splice is 'etal' (which is null). I should have excluded it for
> > clarity. What you're actually seeing is the map being unquoted:
> > user=> `(commands/add ~processed ~@etal)
> > (commands/add {:tag :user, :username "stub" ... }) ;; 'etal' does not
> show
> > up in what gets evaluated - ** first in this list is a function
> >
> > Now, if I try to eval that, I get the said error.
> > user=> (eval `(commands/add ~processed))
> > java.lang.IllegalArgumentException: Wrong number of args (3) passed to:
> > PersistentArrayMap (NO_SOURCE_FILE:324)
> >
> > And I had tried macroexpand (here and in the containing function), and
> got
> > the same error:
> > user=> (macroexpand (eval `(commands/add ~processed)))
> > java.lang.IllegalArgumentException: Wrong number of args (3) passed to:
> > PersistentArrayMap (NO_SOURCE_FILE:324)
> >
> > You're right that the repl is using the map as a function. But I don't
> > understand why when 'commands/add' function was the first thing in the
> > return list. And macroexpand is yielding the same error . This is what
> had
> > me so perplexed. Thanks again for the feedback. It's something small that
> > I'm missing.
> > Tim
> >
> > On Mon, Apr 25, 2011 at 10:40 PM, Kevin Downey <[email protected]>
> wrote:
> >>
> >> your map is being spliced in to the output, but your output contains
> >> lists (...) which are interpreted as functions, and the first thing in
> >> the list is a map, makes take 1-2 args, your list forms with maps as
> >> the operator have more that 2 args. please use macroexpand.
> >>
> >> On Mon, Apr 25, 2011 at 7:29 PM, Timothy Washington <[email protected]
> >
> >> wrote:
> >> > Hey all,
> >> >
> >
> > --
> > 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
>
>
>
> --
> And what is good, Phaedrus,
> And what is not good—
> Need we ask anyone to tell us these things?
>
> --
> 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
>

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

Reply via email to