mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Fix regression in take/drop.
This commit is contained in:
parent
9dad8bf56d
commit
b8df47e063
@ -758,7 +758,8 @@
|
|||||||
(def f (if use-str string/slice tuple/slice))
|
(def f (if use-str string/slice tuple/slice))
|
||||||
(def len (length ind))
|
(def len (length ind))
|
||||||
# make sure end is in [0, len]
|
# make sure end is in [0, len]
|
||||||
(def end (if (< n 0) n (if (> n len) len n)))
|
(def m (if (> n 0) n 0))
|
||||||
|
(def end (if (> m len) len m))
|
||||||
(f ind 0 end))
|
(f ind 0 end))
|
||||||
|
|
||||||
(defn take-until
|
(defn take-until
|
||||||
@ -784,7 +785,8 @@
|
|||||||
(def f (if use-str string/slice tuple/slice))
|
(def f (if use-str string/slice tuple/slice))
|
||||||
(def len (length ind))
|
(def len (length ind))
|
||||||
# make sure start is in [0, len]
|
# make sure start is in [0, len]
|
||||||
(def start (if (< n 0) n (if (> n len) len n)))
|
(def m (if (> n 0) n 0))
|
||||||
|
(def start (if (> m len) len m))
|
||||||
(f ind start -1))
|
(f ind start -1))
|
||||||
|
|
||||||
(defn drop-until
|
(defn drop-until
|
||||||
|
Loading…
Reference in New Issue
Block a user