Changes for clojure.core/map

zkim on Mon, 27 Sep 2010
user=> (map inc [1 2 3 4 5])
(2 3 4 5 6)


;; map can be used with multiple collections. Collections will be consumed
;; and passed to the mapping function in parallel:
user=> (map + [1 2 3] [4 5 6])
(5 7 9)


;; When map is passed more than one collection, the mapping function will
;; be applied until one of the collections runs out:
user=> (map + [1 2 3] (iterate inc 1))
(2 4 6)



;; map is often used in conjunction with the # reader macro:
user=> (map #(str "" % "") ["the" "quick" "brown" "fox"])
("the" "quick" "brown" "fox")

;; A useful idiom to pull "columns" out of a collection of collections:
user=> (apply map vector [[:a :b :c]
                          [:d :e :f]
                          [:g :h :i]])

([:a :d :g] [:b :e :h] [:c :f :i])



;; From http://clojure-examples.appspot.com/clojure.core/map
zkim on Sun, 26 Sep 2010
user=> (map inc [1 2 3 4 5])
(2 3 4 5 6)


;; map can be used with multiple collections. Collections will be consumed
;; and passed to the mapping function in parallel:
user=> (map + [1 2 3] [4 5 6])
(5 7 9)


;; When map is passed more than one collection, the mapping function will
;; be applied until one of the collections runs out:
user=> (map + [1 2 3] (iterate inc 1))
(2 4 6)



;; map is often used in conjunction with the # reader macro:
user=> (map #(str "" % "") ["the" "quick" "brown" "fox"])
("the" "quick" "brown" "fox"

;; A useful idiom to pull "columns" out of a collection of collections:
user=> (apply map vector [[:a :b :c]
                          [:d :e :f]
                          [:g :h :i]])

([:a :d :g] [:b :e :h] [:c :f :i])



;; From http://clojure-examples.appspot.com/clojure.core/map
zkim on Fri, 09 Jul 2010
user=> (map inc [1 2 3 4 5])
(2 3 4 5 6)


map can be used with multiple collections. Collections will be consumed and passed to the mapping function in parallel:
user=> (map + [1 2 3] [4 5 6])
(5 7 9)


When map is passed more than one collection, the mapping function will be applied until one of the collections runs out:
user=> (map + [1 2 3] (iterate inc 1))
(2 4 6)



map is often used in conjunction with the # reader macro:
user=> (map #(str "<p>" % "</p>") ["the" "quick" "brown" "fox"])
("<p>the</p>" "<p>quick</p>" "<p>brown</p>" "<p>fox</p>"

A useful idiom to pull "columns" out of a collection of collections:
user=> (apply map vector [[:a :b :c]
                          [:d :e :f]
                          [:g :h :i]])

([:a :d :g] [:b :e :h] [:c :f :i])


<br>
<br>
From [http://clojure-examples.appspot.com/clojure.core/map](http://clojure-examples.appspot.com/clojure.core/map) with permission.
zkim on Fri, 09 Jul 2010
user=> (map inc [1 2 3 4 5])
(2 3 4 5 6)


map can be used with multiple collections. Collections will be consumed and passed to the mapping function in parallel:
user=> (map + [1 2 3] [4 5 6])
(5 7 9)


When map is passed more than one collection, the mapping function will be applied until one of the collections runs out:
user=> (map + [1 2 3] (iterate inc 1))
(2 4 6)



map is often used in conjunction with the # reader macro:
user=> (map #(str "<p>" % "</p>") ["the" "quick" "brown" "fox"])
("<p>the</p>" "<p>quick</p>" "<p>brown</p>" "<p>fox</p>")
</p>

A useful idiom to pull "columns" out of a collection of collections:
user=> (apply map vector [[:a :b :c]
                          [:d :e :f]
                          [:g :h :i]])

([:a :d :g] [:b :e :h] [:c :f :i])


<br>
<br>
From [http://clojure-examples.appspot.com/clojure.core/map](http://clojure-examples.appspot.com/clojure.core/map) with permission.
zkim on Fri, 09 Jul 2010
user=> (map inc [1 2 3 4 5])
(2 3 4 5 6)


map can be used with multiple collections. Collections will be consumed and passed to the mapping function in parallel:

user=> (map + [1 2 3] [4 5 6])
(5 7 9)


When map is passed more than one collection, the mapping function will be applied until one of the collections runs out:

user=> (map + [1 2 3] (iterate inc 1))
(2 4 6)



map is often used in conjunction with the # reader macro:

user=> (map #(str "<p>" % "</p>") ["the" "quick" "brown" "fox"])
("<p>the</p>" "<p>quick</p>" "<p>brown</p>" "<p>fox>/p>")


A useful idiom to pull "columns" out of a collection of collections:

user=> (apply map vector [[:a :b :c]
                          [:d :e :f]
                          [:g :h :i]])

([:a :d :g] [:b :e :h] [:c :f :i])


<br />
<br />
From [http://clojure-examples.appspot.com/clojure.core/map](http://clojure-examples.appspot.com/clojure.core/map) with permission.