Add eval-when special form
[jscl.git] / src / utils.lisp
index 76b396d..6ab351d 100644 (file)
 ;; You should have received a copy of the GNU General Public License
 ;; along with JSCL.  If not, see <http://www.gnu.org/licenses/>.
 
-(defvar *newline* "
-")
+(/debug "loading utils.lisp!")
 
 (defmacro concatf (variable &body form)
   `(setq ,variable (concat ,variable (progn ,@form))))
 
 ;;; This couple of helper functions will be defined in both Common
-;;; Lisp and in Ecmalisp.
+;;; Lisp and in JSCL
 (defun ensure-list (x)
   (if (listp x)
       x
   (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)))))