Changes for clojure.core/range

rafmagana on Sat, 23 Jun 2012
;; default value of 'end' is infinity
user=> (range)
(0 1 2 3 4 5 6 7 8 9 10 ... 12770 12771 12772 12773 ... n

;; Since clojure 1.2:
user=> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)

user=> (range 10)
(0 1 2 3 4 5 6 7 8 9)

user=> (range -5 5)
(-5 -4 -3 -2 -1 0 1 2 3 4)

user=> (range -100 100 10)
(-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90)

user=> (range 0 4 2)
(0 2)

user=> (range 0 5 2)
(0 2 4)

user=> (range 0 6 2)
(0 2 4)

user=> (range 0 7 2)
(0 2 4 6)

user=> (range 100 0 -10)
(100 90 80 70 60 50 40 30 20 10)

user=> (range 10 -10 -1)
(10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9)
 

rafmagana on Sat, 23 Jun 2012
;; default value of 'end' is infinity
user=> (range)
(0 1 2 3 4 5 6 7 8 9 10 ... 12770 12771 12772 12773 ... n

user=> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)

user=> (range 10)
(0 1 2 3 4 5 6 7 8 9)

user=> (range -5 5)
(-5 -4 -3 -2 -1 0 1 2 3 4)

user=> (range -100 100 10)
(-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90)

user=> (range 0 4 2)
(0 2)

user=> (range 0 5 2)
(0 2 4)

user=> (range 0 6 2)
(0 2 4)

user=> (range 0 7 2)
(0 2 4 6)

user=> (range 100 0 -10)
(100 90 80 70 60 50 40 30 20 10)

user=> (range 10 -10 -1)
(10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9)
 

MrHus on Wed, 05 Jan 2011
user=> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)
user=> (range 5)
(0 1 2 3 4)
user=> (range -5 5)
(-5 -4 -3 -2 -1 0 1 2 3 4)
user=> (range -100 100 10)
(-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90)

user=> (range 0 4 2)
(0 2)
user=> (range 0 5 2)
(0 2 4)
user=> (range 0 6 2)
(0 2 4)
user=> (range 0 7 2)
(0 2 4 6)

user=> (range 100 0 -10)
(100 90 80 70 60 50 40 30 20 10)

user=> (range 10 -10 -1)
(10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9)
 

zkim on Sun, 26 Sep 2010
user=> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)
user=> (range 5)
(0 1 2 3 4)
user=> (range -5 5)
(-5 -4 -3 -2 -1 0 1 2 3 4)
user=> (range -100 100 10)
(-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90)

user=> (range 0 4 2)
(0 2)
user=> (range 0 5 2)
(0 2 4)
user=> (range 0 6 2)
(0 2 4)
user=> (range 0 7 2)
(0 2 4 6)

Dmitry Kakurin on Sun, 25 Jul 2010
user> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)
user> (range 5)
(0 1 2 3 4)
user> (range -5 5)
(-5 -4 -3 -2 -1 0 1 2 3 4)
user=> (range -100 100 10)
(-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90)

user=> (range 0 4 2)
(0 2)
user=> (range 0 5 2)
(0 2 4)
user=> (range 0 6 2)
(0 2 4)
user=> (range 0 7 2)
(0 2 4 6)

Dmitry Kakurin on Sun, 25 Jul 2010
user> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)
user> (range 5)
(0 1 2 3 4)
user> (range -5 5)
(-5 -4 -3 -2 -1 0 1 2 3 4)
user=> (range -100 100 10)
(-100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90)
Dmitry Kakurin on Sun, 25 Jul 2010
user> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)
user> (take 10 (range 15))
(0 1 2 3 4 5 6 7 8 9)
user> (take 20 (range -15 15))
(-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4)
user> (take 10 (range -100 100 5))
(-100 -95 -90 -85 -80 -75 -70 -65 -60 -55)
Dmitry Kakurin on Sun, 25 Jul 2010
user> (take 10 (range))
(0 1 2 3 4 5 6 7 8 9)
user> (take 10 (range 15))
(0 1 2 3 4 5 6 7 8 9)
user> (take 20 (range -15 15))
(-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4)
user> (take 10 (range -100 100 5))
(-100 -95 -90 -85 -80 -75 -70 -65 -60 -55)
nipra on Wed, 14 Jul 2010
user> (def *nums* (range))
#'user/*nums*
user> (take 10 *nums*)
(0 1 2 3 4 5 6 7 8 9)
user> (take 10 (range 15))
(0 1 2 3 4 5 6 7 8 9)
user> (take 20 (range -15 15))
(-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4)
user> (take 10 (range -100 100 5))
(-100 -95 -90 -85 -80 -75 -70 -65 -60 -55)