diff options
author | Arun Isaac | 2021-06-01 13:55:57 +0530 |
---|---|---|
committer | Arun Isaac | 2021-06-01 13:55:57 +0530 |
commit | 49020e72a73adb730143be2dc3c3232fab9fff1e (patch) | |
tree | 588c41918f764936904428cb747f61cd8529f84c | |
parent | 2324856e72ef1f0f16a91475498753674df8c8ef (diff) | |
download | ccwl-49020e72a73adb730143be2dc3c3232fab9fff1e.tar.gz ccwl-49020e72a73adb730143be2dc3c3232fab9fff1e.tar.lz ccwl-49020e72a73adb730143be2dc3c3232fab9fff1e.zip |
Add syntax-lambda**.
* ccwl/utils.scm (syntax-lambda**): New public macro.
-rw-r--r-- | ccwl/utils.scm | 11 |
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 |