Skip to content
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

Commit 73eb041

Browse files
committed
Make take-while's implementation a little less silly
1 parent 5eefb8a commit 73eb041

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/core/list.lisp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -676,14 +676,12 @@
676676
(let* [(l '())
677677
(ln (n xs))
678678
(x (nth xs idx))]
679-
(if (nil? x)
680-
'()
681-
(progn
682-
(while (and (<= idx ln) (p x))
683-
(push-cdr! l x)
684-
(set! idx (+ idx 1))
685-
(set! x (nth xs idx)))
686-
l))))
679+
(unless (nil? x)
680+
(while (and (<= idx ln) (p x))
681+
(push-cdr! l x)
682+
(set! idx (+ idx 1))
683+
(set! x (nth xs idx))))
684+
l))
687685

688686
(defun split (xs y)
689687
"Splits a list into sub-lists by the separator Y.

0 commit comments

Comments
 (0)