(defun span (predicate list) "Splits LIST into two lists (returned as VALUES) such that elements in the first list are taken from the head of LIST while PREDICATE is satisfied, and elements in the second list are the remaining elements from LIST once PREDICATE is not satisfied." (do* ((xs list (rest xs)) (x (first xs) (first xs)) (ys (cons x nil) (cons x ys))) ((or (null xs) (not (funcall predicate x))) (values (nreverse (rest ys)) xs))))