Re: using -> on a nested hash-map with string keywords.

2012-06-01 Thread Sean Corfield
On Fri, Jun 1, 2012 at 12:08 AM, Boris V. Schmid wrote: > Thanks, it was get-in that I was looking for, but couldn't find. At this point I'll give a plug for http://clojureatlas.com as a great way to explore the Clojure core/libraries by concept. -- Sean A Corfield -- (904) 302-SEAN An Architect

Re: using -> on a nested hash-map with string keywords.

2012-06-01 Thread Boris V. Schmid
Thanks, it was get-in that I was looking for, but couldn't find. Also thanks to Dave for explaining that keywords have some internal magic compared to strings. will remember! On Thursday, 31 May 2012 19:22:50 UTC+2, Alan Malloy wrote: > > Yes, but really to GET a value nested IN a series of maps

Re: using -> on a nested hash-map with string keywords.

2012-05-31 Thread Dave Ray
Too true. On Thu, May 31, 2012 at 10:22 AM, Alan Malloy wrote: > Yes, but really to GET a value nested IN a series of maps, he should > just be using get-in, rather than threading anything at all. > > On May 31, 7:59 am, Dave Ray wrote: >> Keywords implement IFn meaning they can act as functions

Re: using -> on a nested hash-map with string keywords.

2012-05-31 Thread Alan Malloy
Yes, but really to GET a value nested IN a series of maps, he should just be using get-in, rather than threading anything at all. On May 31, 7:59 am, Dave Ray wrote: > Keywords implement IFn meaning they can act as functions that look > themselves up in a map. Strings are just strings. Replace "b

Re: using -> on a nested hash-map with string keywords.

2012-05-31 Thread Jay Fields
(:b {:b 1}) => 1 ("b" {"b" 1}) => same error. If you want that to work, you need something that creates ({"b" 1} "b") or (get {"b" 1} "b") for your example, I believe this works (-> (hash-map "b" (hash-map :a 3)) (get "b") :a) Cheers, Jay On Thu, May 31, 2012 at 10:55 AM, Boris V. Schmid wrote:

Re: using -> on a nested hash-map with string keywords.

2012-05-31 Thread Dave Ray
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 wrote: > Can someone tell me what I'm overlooking