summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccwl/utils.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/ccwl/utils.scm b/ccwl/utils.scm
index 71bc1fe..d0db51c 100644
--- a/ccwl/utils.scm
+++ b/ccwl/utils.scm
@@ -30,6 +30,7 @@
#:export (pairify
plist->alist
lambda**
+ syntax-lambda**
mapn
append-mapn
foldn))
@@ -134,6 +135,16 @@ for example, be invoked as:
rest (list #,@(map (compose symbol->keyword syntax->datum)
unary-arguments))))))))))))
+(define-syntax-rule (syntax-lambda** formal-args body ...)
+ "Like lambda**, but for syntax objects. This is useful for writing
+macros that accept keyword arguments."
+ (lambda (x)
+ (apply (lambda** formal-args body ...)
+ (with-ellipsis :::
+ (syntax-case x ()
+ ((_ args :::)
+ (unsyntax-keywords #'(args :::))))))))
+
(define (mapn proc lst)
"Map the procedure PROC over list LST and return a list containing
the results. PROC can return multiple values, in which case, an equal