Re: Getting information from a hashmap that is inside anothe hashmap

2016-11-24 Thread paul
Not quite. The -> operator basically puts the prior result in as argument number one of the next statement, so you need to create an expression who, when it has the result of :char put in position 1, returns a vector of eye color and hair color Luckily the core library has a function (juxt) whi

Re: Getting information from a hashmap that is inside anothe hashmap

2016-11-24 Thread 'Rickesh Bedia' via Clojure
That makes sense. Thanks for the help. Also say I wanted to get both eye-colour and hair-colour. Could that be done by (-> human2 :char [:eye-colour :hair-colour])? On Tuesday, 22 November 2016 11:08:45 UTC, Bost wrote: > > (->> human2 :char :eye-colour) or > (-> human2 :char :eye-colour) or >

Re: Getting information from a hashmap that is inside anothe hashmap

2016-11-22 Thread Rostislav Svoboda
(->> human2 :char :eye-colour) or (-> human2 :char :eye-colour) or ((human2 :char) :eye-colour) or (:eye-colour (:char human2)) all variants work. Either way it looks like you're asking a very basic question. I recomend you to go over http://clojurekoans.com/ or read some tutorial, quick start gui

Re: Getting information from a hashmap that is inside anothe hashmap

2016-11-22 Thread Baishampayan Ghose
You may use `get-in`. https://clojuredocs.org/clojure.core/get-in (get-in human2 [:char :eye-colour]) ;=> "red" Hope this helps. ~BG On Tue, Nov 22, 2016 at 4:12 PM, 'Rickesh Bedia' via Clojure wrote: > Lets say I have: > (def human {:firstname "John" :surname "Smith"}) > To get the firstn