Keywords implement IFn meaning they can act as functions that look
themselves up in a map. Strings are just strings. Replace "b" with
(get "b") and you'll get the behavior you're looking for.

Dave

On Thu, May 31, 2012 at 7:55 AM, Boris V. Schmid <boris.sch...@gmail.com> wrote:
> Can someone tell me what I'm overlooking (clojure 1.4)
>
> (-> (hash-map :b (hash-map :a 3)) :b :a)
> 3
> user> (-> (hash-map "b" (hash-map :a 3)) "b" :a)
> ; Evaluation aborted: java.lang.String cannot be cast to clojure.lang.IFn
>
> I'm not sure why the first can work, and the second cannot. Is it a logical
> limitation of the language, or an oversight in how the macro -> is build?
>
> --
> 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

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