Hi there,
When writing syntax-case macros, often one would write:
(define-syntax foo
(lambda (bar)
(syntax-case bar ...)))
This seems overly long-winded; it would be preferable to be able to
write, instead:
(define-syntax (foo bar)
(syntax-case bar ...))
Attached is a patch that implements that. Note that there is nothing
original in this patch---it's just a straight copy-and-paste of the
"define" version immediately above, except changing define-form to
define-syntax-form---so there should be nothing controversial from a
correctness and/or copyright point of view.
Let me know what you think.
Many thanks,
Chris.
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm
index 957a526..e83b3ff 100644
--- a/module/ice-9/psyntax.scm
+++ b/module/ice-9/psyntax.scm
@@ -1168,7 +1168,16 @@
((_ name val)
(id? #'name)
(values 'define-syntax-form #'name
- #'val w s mod))))
+ #'val w s mod))
+ ((_ (name . args) e1 e2 ...)
+ (and (id? #'name)
+ (valid-bound-ids? (lambda-var-list #'args)))
+ ;; need lambda here...
+ (values 'define-syntax-form (wrap #'name w mod)
+ (decorate-source
+ (cons #'lambda (wrap #'(args e1 e2 ...) w mod))
+ s)
+ empty-wrap s mod))))
(else
(values 'call #f e w s mod)))))))
((syntax-object? e)