1
0
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:
Calvin Rose 2019-03-04 15:44:30 -05:00
parent 8d37e544ab
commit 4a2d4f52b5

View File

@ -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
@ -1531,7 +1531,7 @@ value, one key will be ignored."
(var pindex 0)
(var pstatus nil)
(def len (length buf))
(when (= len 0)
(when (= len 0)
(parser/eof p)
(set going false))
(while (> len pindex)