Am Di., 3. März 2020 um 10:55 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
> (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.

As Shiro pointed out, I should have probably written this in portable R6RS:

(define-syntax +
  (lambda (stx)
    (syntax-case stx ()
      ((_ x y) #'(fast-binary-plus x y))
      (_ #'slow-general-plus))))

It should now work in any R6RS system and in any R7RS system that supports this fragment of the `syntax-case' system.
Marc