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