[alexandria-devel] [PATCH] Added Scheme's LET as LET@

Pierre Thierry pierre at nothos.net
Thu Aug 2 02:41:40 UTC 2012


---
 binding.lisp |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/binding.lisp b/binding.lisp
index 36d92bc..19c3750 100644
--- a/binding.lisp
+++ b/binding.lisp
@@ -91,3 +91,19 @@ PROGN."
          (when ,(caar binding-list)
            ,@(bind (cdr binding-list) forms))))))
 
+(defmacro let@ (name bindings &body body)
+    "LET@ is RnRS' LET.
+
+BINDINGS is a list of bindings of the form:
+
+ ((argument-1 initial-form-1)
+  (argument-2 initial-form-2)
+  ...
+  (argument-n initial-form-n))
+
+LET@ creates a local function named NAME with lambda-list
+(argument-1 argument-2 ... argument-n) and body BODY. This
+function is then called with the evaluations of the intitial
+forms as arguments."
+  `(labels ((,name ,(mapcar #'first bindings) , at body))
+     (,name ,@(mapcar #'second bindings))))
-- 
1.7.10.4





More information about the alexandria-devel mailing list