From b8df47e063c7eaeb4b4de677141dca5948fa851a Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Fri, 24 Jan 2020 17:39:25 -0600 Subject: [PATCH] Fix regression in take/drop. --- src/boot/boot.janet | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 180709f5..4c2a3304 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -758,7 +758,8 @@ (def f (if use-str string/slice tuple/slice)) (def len (length ind)) # 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)) (defn take-until @@ -784,7 +785,8 @@ (def f (if use-str string/slice tuple/slice)) (def len (length ind)) # 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)) (defn drop-until