2010/11/9 Carlos Moscoso <moscoso....@gmail.com>:
> user=> (-> {:a 1} (keyword "a"))

-> is simply a code rewrite macro. You can use macroexpand-1 to see
how the rewrite is done:

user=> (macroexpand-1 '(-> {:a 1} (keyword "a")))
(keyword {:a 1} "a")

As Sunil said, you can get the desired behaviour by adding parentheses:

user=> (macroexpand-1 '(-> {:a 1} ((keyword "a"))))
((keyword "a") {:a 1})

In this simple case, a simple get would be sufficient:

user=> (get {:a 1} (keyword "a"))
1

...but I guess the code you posted was only the minimal case to
reproduce the error.

Sometimes, get-in can also be an alternative to ->.

// raek

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