X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Futils.lisp;h=6ab351d1f21fc9a780a442638e685eb9ee727011;hb=81003ba7f1fcb0d2e4232433665725f9286a958e;hp=5cb702c6f385d79d8f045ecc1409f981b90ad943;hpb=c296885ca974898925b89af066b1b14a6fca0f57;p=jscl.git diff --git a/src/utils.lisp b/src/utils.lisp index 5cb702c..6ab351d 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -18,9 +18,6 @@ (/debug "loading utils.lisp!") -(defvar *newline* " -") - (defmacro concatf (variable &body form) `(setq ,variable (concat ,variable (progn ,@form)))) @@ -93,3 +90,14 @@ (let ((key-val (if key (funcall key y) y)) (fn (if test-not-p (complement test-not) test))) (funcall fn x key-val))) + + +(defun interleave (list element &optional after-last-p) + (unless (null list) + (with-collect + (collect (car list)) + (dolist (x (cdr list)) + (collect element) + (collect x)) + (when after-last-p + (collect element)))))