Timothy Washington wrote:
> user=> (eval `(commands/add ~processed ~@etal))
Is there a reason for using eval here, such as you're debugging a
macro, or could you just use
user=> (apply commands/add processed etal)
?
--
You received this message because you are subscribed to the Google
Groups
Ah, I see I see. Well it's all starting to click. I didn't realise eval
tries to execute all the nested forms inside that map. I just turned those
into vectors and I'm back on my way :)
Thanks guys
Tim
On Tue, Apr 26, 2011 at 3:32 AM, Alan wrote:
> You are using macroexpand wrong. Don't eval a
You are using macroexpand wrong. Don't eval anything when you are
macroexpanding - the point is to see what code will be executed.
The issue Kevin is bringing to your attention is evident in the first
code snippet you gave:
... :content ({:tag :profileDetail, :name
"first.name", :value "stub", :
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=> ( ) ;; ** first in this list is a function
*
Now, if I try to eval that, I get the said erro
sorry I cannot read your email
On Mon, Apr 25, 2011 at 8:24 PM, Timothy Washington 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 ~
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
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
Hey all,
I'm not quite understanding why an eval call is not working in this
instance. A) works, but B) fails with an *java.lang.IllegalArgumentException
*.
A) Pretty straightforward ...
user=> `(+ 1 ~@[2 3])
(clojure.core/+ 1 2 3)
…
user=> (eval `(+ 1 ~@[2 3]))
6
B) I just want to cal