diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-31 17:51:40 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-31 17:51:40 +0200 |
commit | 3ee58e9081354aed7bc45de457c0171aa78c613c (patch) | |
tree | 25bf7814372d7138bec5bd3ed47ad58cabc34591 | |
parent | 64988d63eb7ff9f324395a03fc6a927b2639bb5e (diff) |
Add PROG1, PROG2, NREVERSE, and ACONS.
-rw-r--r-- | control-flow.lisp | 13 | ||||
-rw-r--r-- | list-functions-2.lisp | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/control-flow.lisp b/control-flow.lisp index b03a666..d9998e2 100644 --- a/control-flow.lisp +++ b/control-flow.lisp @@ -38,6 +38,19 @@ `(setq ,name ,value)) +(defmacro prog1 (form &body forms) + (let ((varsym (gensym))) + `(let ((,varsym ,form)) + ,@forms + ,varsym))) + +(defmacro prog2 (form1 form2 &body forms) + `(progn + ,form1 + (prog1 ,form2 + ,@forms))) + + ;; FIXME: Should be (EVAL-WHEN (:compile-toplevel) ...). (unless (boundp '+block-mapping-sym+) (defconstant +block-mapping-sym+ (gensym "BLOCK-NAME"))) diff --git a/list-functions-2.lisp b/list-functions-2.lisp index 09c8449..9bdb53e 100644 --- a/list-functions-2.lisp +++ b/list-functions-2.lisp @@ -115,3 +115,9 @@ (defun mapcon (function list &rest more-lists) (%append (apply 'maplist (list* function list more-lists)))) + +(defun nreverse (list) + (reverse list)) + +(defun acons (indicator value alist) + (cons (cons indicator value) alist)) |