diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-03 01:22:34 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-03 01:22:34 +0200 |
commit | 7cb5a0900b5e1b4c1ecf1fe602ab9ac71ca62d77 (patch) | |
tree | f113e55a8ede4e475be3b5de6b31a8d2ecd588a4 | |
parent | 99a113921af70dc3e9d74c01bb3004d131feec1d (diff) |
Add LABELS.
TAGBODY and GO work now.
-rw-r--r-- | control-flow.lisp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/control-flow.lisp b/control-flow.lisp index a4503ab..b2c9953 100644 --- a/control-flow.lisp +++ b/control-flow.lisp @@ -19,7 +19,7 @@ (in-package #:common-lisp) (export '(identity constantly complement tagbody go block return-from - defconstant prog prog* macrolet flet prog1 prog2)) + defconstant prog prog* macrolet flet prog1 prog2 labels)) (defun identity (x) @@ -34,6 +34,16 @@ (lambda (x) (not (funcall function x)))) +(defmacro labels ((&rest function-bindings) &body forms) + "Look, ma, I've defined LABELS in terms of FLET!" + `(flet ,(mapcar (lambda (x) `(,(first x) ())) function-bindings) + (%fsetq ,@(mapcan (lambda (x) + `(,(first x) (lambda ,(second x) ,@(rest (rest x))))) + function-bindings)) + nil + ,@forms)) + + (defmacro defconstant (name value &optional documentation) `(setq ,name ,value)) |