diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-30 11:31:42 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-30 11:31:42 +0200 |
commit | 31a8affed35fa3442b11c1c62aa61e583f5bbef1 (patch) | |
tree | 50ce93f5bc29a87e23a28524d6d1bac3532e4847 | |
parent | 90f25b6646a01400973430e043dffe82cce1e61b (diff) |
Add DOLIST and MAPC.
-rw-r--r-- | list-functions.lisp | 18 |
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)) + + +;;;;----------------------------------------------------------------- |