;; return first N of list for which predicate is truthy
(define take-while
(lambda (pred lst)
(let loop ((ret '())
(remaining lst))
(cond
((null? remaining) (reverse ret))
((pred (car remaining)) (loop (cons (car remaining) ret) (cdr remaining)))
(else (reverse ret))))))