mirror of
https://github.com/janet-lang/janet
synced 2024-11-29 03:19:54 +00:00
Allow inverted ranges with negative steps.
This commit is contained in:
parent
8d37e544ab
commit
4a2d4f52b5
@ -697,9 +697,9 @@
|
|||||||
arr)
|
arr)
|
||||||
3 (do
|
3 (do
|
||||||
(def [n m s] args)
|
(def [n m s] args)
|
||||||
(def arr (array/new (math/ceil (/ n s))))
|
(if (neg? s)
|
||||||
(loop [i :range [n m s]] (array/push arr i))
|
(seq [i :down [n m (- s)]] i)
|
||||||
arr)
|
(seq [i :range [n m s]] i)))
|
||||||
(error "expected 1 to 3 arguments to range")))
|
(error "expected 1 to 3 arguments to range")))
|
||||||
|
|
||||||
(defn find-index
|
(defn find-index
|
||||||
|
Loading…
Reference in New Issue
Block a user