Syntax for identifier syntax Lassi Kortela 03 Mar 2020 09:54 UTC

> (define-syntax foo
>    (syntax-rules ()
>      ((_ x y) ...)
>      (_ ...)))
>
> If `foo' is used as `(foo x y)', the first clause will be expanded; if
> `foo' is used in any other context, the second clause will be used.
>
> An example could be:
>
> (define-syntax +
>    (syntax-rules ()
>      ((_ x y) (fast-binary-plus x y))
>      (_ slow-general-plus)))

This seems very neat to me. Currently the non-parenthesized case just
gives an "invalid use of syntax as value" error.