Hi Roelof, On 24 Oct 2014, at 15:00, Roelof Wobben <rwob...@hotmail.com> wrote:
> (defn second-elements [collection] > (let [second-item (fn [x] (get x 1))] > (map second-item collection))) > > one thing I m not sure I understand complete. x is the output of the map > command, if so, how does Clojure know that. Not quite. the map function evaluates to a sequence of items: the items in the input collection, except with f applied to each one of them. This function: > (fn [x] (get x 1)) … takes a single item and does something to it (gets the first element out). `map` is responsible for calling it on each item. hth lvh
signature.asc
Description: Message signed with OpenPGP using GPGMail