Op vrijdag 24 oktober 2014 14:09:13 UTC+2 schreef Laurens Van Houtven:
>
> Hi Roelof, 
>
> On 24 Oct 2014, at 14:05, Roelof Wobben <rwo...@hotmail.com <javascript:>> 
> wrote: 
>
> > I have to use map and get a vector of all the second items in a list. 
> > I know I can use map to do things with all the items in a list. 
> > and with get I can get the second item (get collection 1) 
>
> Yes, depending on what the items in the list are. For vectors, for 
> example, that will work. 
>
> > map uses this map what_has _to_be_done  collection 
> > 
> > so I thougt this would work (map (get collection 1) collection) 
> > but then I see this error message :   
> java.lang.IllegalArgumentException: Key must be integer   
>
> You are applying get to a real collection. map takes a function to be 
> applied to each element. For example, #(get % 1). 
>
> More idiomatic: (map second xs). 
>
> cheers 
> lvh 
>
>
oke, and second could be the helper function.
I know what schould be done map has to pick up the items and on that item I 
have to be doing the  get. 

Roelof
 

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