mirror of
https://github.com/janet-lang/janet
synced 2025-10-14 07:17:40 +00:00
Allow inverted ranges with negative steps.
This commit is contained in:
@@ -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
|
||||||
@@ -1531,7 +1531,7 @@ value, one key will be ignored."
|
|||||||
(var pindex 0)
|
(var pindex 0)
|
||||||
(var pstatus nil)
|
(var pstatus nil)
|
||||||
(def len (length buf))
|
(def len (length buf))
|
||||||
(when (= len 0)
|
(when (= len 0)
|
||||||
(parser/eof p)
|
(parser/eof p)
|
||||||
(set going false))
|
(set going false))
|
||||||
(while (> len pindex)
|
(while (> len pindex)
|
||||||
|
Reference in New Issue
Block a user