git.fiddlerwoaroof.com
Browse code

Extensions to let-each (untested)

fiddlerwoaroof authored on 19/04/2016 03:33:34
Showing 1 changed files
... ...
@@ -8,11 +8,10 @@
8 8
            collect (list be form))
9 9
      ,be))
10 10
 
11
-(defmacro let-first ((&key (be '*)) &body forms)
11
+(defmacro let-first ((&key (be '*)) bound &body forms)
12 12
   "Bind the result of the first form to the symbol specified via :be"
13
-  `(let* ((,be ,(car forms)))
14
-     ,@(loop for form in (cdr forms)
15
-             collect (list be form))
13
+  `(let* ((,be ,bound))
14
+     ,@forms
16 15
      ,be))
17 16
 
18 17
 (defmacro let-second ((&key (be '*)) &body forms)
... ...
@@ -20,8 +19,7 @@
20 19
   `(progn
21 20
      ,(car forms)
22 21
      (let* ((,be ,(cadr forms)))
23
-       ,@(loop for form in (cddr forms)
24
-               collect (list be form))
22
+       ,@(cddr forms)
25 23
        ,be)))
26 24
 
27 25
 (defmacro lambda-if ((test &rest args) &body body)