(let orig range (def range (x (o y)) (if y (orig x y) (orig 0 x)))) ;could be (orig 0 (- x 1)) to be even more Python-like
(def range (start (o end) (o step 1)) (let test (if (positive step) >= <=) (when (no end) (= end start start 0)) (if (test start end) nil (cons start (range (+ start step) end step))))) arc> (range 10) (0 1 2 3 4 5 6 7 8 9) arc> (range 10 1) nil arc> (range 1 10) (1 2 3 4 5 6 7 8 9) arc> (range 1 10 2) (1 3 5 7 9) arc> (range 1 10 -2) nil arc> (range 10 1 -2) (10 8 6 4 2) arc> (range 10 1 -1) (10 9 8 7 6 5 4 3 2)
(reverse (range 10)), or (map [* 2 _] (range 5)) ?
-----