X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Futils.lisp;h=d380e4c29b6b93c2b8ce6508c60c32f298462f49;hb=587d21c0521468b08f1e1b045f2d08a3a93873a5;hp=aa097af5d58db05249508f27297fd064d061eb99;hpb=d6435f07a86f9df5db3195ffe7c8fc3f9a246ee3;p=jscl.git diff --git a/src/utils.lisp b/src/utils.lisp index aa097af..d380e4c 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -16,6 +16,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with JSCL. If not, see . +(/debug "loading utils.lisp!") + (defvar *newline* " ") @@ -91,3 +93,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)))))