summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--list-functions.lisp18
1 files changed, 17 insertions, 1 deletions
diff --git a/list-functions.lisp b/list-functions.lisp
index 3660e5e..1912238 100644
--- a/list-functions.lisp
+++ b/list-functions.lisp
@@ -3,7 +3,7 @@
caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar
caddar cadddr caddr cadr car cdaaar cdaadr cdaar cdadar cdaddr
cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr
- rest))
+ rest mapc dolist))
(%defmacro* pushq args
@@ -200,3 +200,19 @@
;;;;-----------------------------------------------------------------
+;;;; ITERATION
+;;;;-----------------------------------------------------------------
+(defun mapc (function list)
+ ;;FIXME: Rewrite using TAGBODY.
+ (when list
+ (funcall function (first list))
+ (mapc function (rest list))))
+
+(defmacro dolist ((var list &optional result) &body body)
+ ;;FIXME: Rewrite using TAGBODY.
+ `(progn
+ (mapc (lambda (,var) ,@body) ,list)
+ ,result))
+
+
+;;;;-----------------------------------------------------------------