From 3ee58e9081354aed7bc45de457c0171aa78c613c Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 31 Jul 2008 17:51:40 +0200 Subject: Add PROG1, PROG2, NREVERSE, and ACONS. --- control-flow.lisp | 13 +++++++++++++ list-functions-2.lisp | 6 ++++++ 2 files changed, 19 insertions(+) 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)) -- cgit v1.2.3