Because the information is coming from a table I don't know if I can change 
it to look like that.

The information from the table looks like {:people ({:name "John" :age 25} 
{:name "Harry" :age 23} {:name "Peter" :age 24})}

I was wondering if you could apply (into [] (map (-> class1 :people) [:name 
:age])) to each of the {:name "Peter" :age "24"}, {:name "John" :age "25"}, 
{:name "Harry" :age "23"} and then put that into a vector so the final 
vector is in the form 
[["John" "25"]
 ["Harry" "23"]
 ["Peter" "24"]]

On Wednesday, 30 November 2016 10:37:04 UTC, Colin Yates wrote:
>
> (def class1 {:people '({:name "John" :age "25"} {:name "Harry" :age 
> "23"} {:name "Peter" :age "24"})}) or (def class1 {:people [{:name 
> "John" :age "25"} {:name "Harry" :age "23"} {:name "Peter" :age 
> "24"}]}) is probably what you want. 
>
> (mapv (juxt :name :age) (:people class1)) on either of those will give 
> you your result. 
>
> On 30 November 2016 at 10:34, Colin Yates <colin...@gmail.com 
> <javascript:>> wrote: 
> > Ah, I just realised people is _not_ a sequence of maps but the result 
> > of calling '{:name "John" :age "25"}' passing in the other two maps as 
> > arguments. You probably want a literal literal '({:name "John" :age 
> > "25"}.....) or a vector [{:name "John" :age "25"}...] 
> > 
> > On 30 November 2016 at 10:29, Colin Yates <colin...@gmail.com 
> <javascript:>> wrote: 
> >> (mapv (juxt :name :age) (:people class1)) should work 
> >> 
> >> On 30 November 2016 at 10:27, 'Rickesh Bedia' via Clojure 
> >> <clo...@googlegroups.com <javascript:>> wrote: 
> >>> I have a definition: 
> >>> (def class1 {:people ({:name "John" :age "25"} 
> >>>                                   {:name "Harry" :age "23"} 
> >>>                                   {:name "Peter" :age "24"})}) 
> >>> 
> >>> The result I want is a vector that looks like 
> >>> [["John" "25"] 
> >>>  ["Harry" "23"] 
> >>>  ["Peter" "24"]] 
> >>> 
> >>> If I call (map (-> class1 :people) [:name :age]) 
> >>> then I get the result ("Peter" "24"). Why do I only get the values 
> from the 
> >>> last hashmap and not the others? 
> >>> 
> >>> If I then call (into [] (map (-> class1 :people) [:name :age])) 
> >>> then I get the result ["Peter" "24"] 
> >>> 
> >>> What I need to do is run the 'into' function again on the other two 
> hashmaps 
> >>> and then put the 3 results into a vector but I don't know how to do 
> this. 
> >>> 
> >>> Any help would be much appreciated 
> >>> 
> >>> -- 
> >>> You received this message because you are subscribed to the Google 
> >>> Groups "Clojure" group. 
> >>> To post to this group, send email to clo...@googlegroups.com 
> <javascript:> 
> >>> Note that posts from new members are moderated - please be patient 
> with your 
> >>> first post. 
> >>> To unsubscribe from this group, send email to 
> >>> clojure+u...@googlegroups.com <javascript:> 
> >>> 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 unsubscribe from this group and stop receiving emails from it, send 
> an 
> >>> email to clojure+u...@googlegroups.com <javascript:>. 
> >>> For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to