mes: Add take-while.

* mes/module/srfi/srfi-1.mes (take-while): New function.
This commit is contained in:
Jan Nieuwenhuizen 2018-12-27 16:36:22 +01:00
parent 3e41363232
commit df27830846
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 4 additions and 0 deletions

View File

@ -142,3 +142,7 @@
(cons (car lst) (loop (cdr lst))))))))
(include-from-path "srfi/srfi-1.scm")
(define (take-while pred lst)
(if (or (null? lst) (not (pred (car lst)))) '()
(cons (car lst) (take-while pred (cdr lst)))))