(defun fold-strings (list) (declare (optimize (speed 3) (safety 0) (debug 0))) (let ((strings '()) (result '())) (dolist (object list) (typecase object (string (push object strings)) (t (when strings (push (join-strings (nreverse strings)) result) (setf strings '())) (push object result)))) (when strings (push (join-strings (nreverse strings)) result)) (nreverse result)))Source Context