Sorry but I still do not have a clue how clojure knows what x is. 

the first part where x is mentioned is the fn part and on the map 
part there is no mention about x.  

Roelof


Op vrijdag 24 oktober 2014 15:51:30 UTC+2 schreef Laurens Van Houtven:

> Hi Roelof, 
>
> > I understand that part. 
> > 
> > so we have (map second-item collection)  where second-item and 
> collection are arguments of map. 
>
> Yep. 
>
> > Then we have second-item ( fn [x] (get x 2)   
> > which can be read as : 
> > 
> > ( second-item [x] (get x 2)  . 
>
> This makes no sense to me. second-item is a fn. In this syntax, (malformed 
> because of a missing closing bracket), you are calling second-item with [x] 
> and (get x 2), without having defined x. 
>
> > in the map there is only ( map second-item collection) 
> > 
> > or is the collection a argument of second-item and a argument of map. 
>
> No. second-item and collections are the arguments of map. map will call 
> second-item for each element in coll. map’s job is to “pull apart” the 
> collection, element by element, pass it to f, and give you the result back. 
>
> hth 
> lvh 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to