From 831dce95cf35910cf618b00e5fba99175e63319a Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Tue, 8 Jan 2013 19:29:20 +0000 Subject: [PATCH] return argument is optional and assoc uses non local exit --- ecmalisp.lisp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 51187e6..3033203 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -71,7 +71,7 @@ (defun null (x) (eq x nil)) - (defmacro return (value) + (defmacro return (&optional value) `(return-from nil ,value)) (defmacro while (condition &body body) @@ -393,12 +393,11 @@ t)) (defun assoc (x alist) - (let ((found nil)) - (while (and alist (not found)) - (if (eql x (caar alist)) - (setq found t) - (setq alist (cdr alist)))) - (car alist))) + (while alist + (if (eql x (caar alist)) + (return) + (setq alist (cdr alist)))) + (car alist)) (defun string= (s1 s2) (equal s1 s2))) -- 1.7.10.4