Changes for clojure.core/iterate

rafmagana on Sat, 23 Jun 2012
;; iterate Ad Infinitum starting at 5 using the inc (increment) function
user=> (iterate inc 5)
(5 6 7 8 9 10 11 12 13 14 15 ... n

;; limit results
user=> (take 5 (iterate inc 5))
(5 6 7 8 9)

user=> (take 10 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18)

user=> (take 20 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)

rafmagana on Sat, 23 Jun 2012
;; iterate Ad Infinitum starting at 5 using the inc (increment) function
user=> (iterate inc 5)
(5 6 7 8 9 10 11 12 13 14 15 ... n

user=> (take 10 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18)

user=> (take 20 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)

rafmagana on Sat, 23 Jun 2012
;; iterate Ad Infinitum starting at 5 using the inc function
user=> (iterate inc 5)
(5 6 7 8 9 10 11 12 13 14 15 ... n

user=> (take 10 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18)

user=> (take 20 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)

rafmagana on Sat, 23 Jun 2012
;; iterate Ad Infinitum starting at 5 using the inc (http://clojuredocs.org/clojure_core/clojure.core/inc) function
user=> (iterate inc 5)
(5 6 7 8 9 10 11 12 13 14 15 ... n

user=> (take 10 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18)

user=> (take 20 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)

zkim on Sun, 26 Sep 2010
user=> (take 10 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18)

user=> (take 20 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)

devijvers on Tue, 13 Jul 2010
user=> (take 10 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18)
user=> (take 20 (iterate (partial + 2) 0))
(0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)
user=>
nipra on Tue, 13 Jul 2010
;;; Lazy sequence of all non-negative even numbers
user> (def *nums* (iterate #(+ % 2) 0))
#'user/*nums*
;;; First 10 non-negative even numbers
user> (take 10 *nums*)
(0 2 4 6 8 10 12 14 16 18)