(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 ((list list (rest list)) (xs nil (cons (first list) xs))) ((or (null list) (not (funcall predicate (first list)))) (values (nreverse xs) list))))