On Wed, Mar 4, 2020 at 1:12 PM Jim Rees <xxxxxx@gmail.com> wrote:

(define-syntax +
   (lambda (stx)
      (syntax-case stx ()
         ((_ x y) #'(fast-binary-plus x y)
         ((_ arg ...) #'(slow-general-plus arg ...))
         ((id (identifier? #'id) #'slow-general-plus))))

..otherwise, the (_ #'slow-general-plus) clause will match the entire form (+ a b c d ...), not just the identifier +, and the result of expression will be the slow-general-plus procedure object.

This should also resolve John's concern.

It does.  My difficulty was more fundamental; I didn't know that syntax-case pattern matching allows a top-level pattern to be an identifier.  The syntax-rules pattern matcher requires the top level to be a list in R[567]RS.  I was only familiar with the use of identifier-syntax in this connection.



John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
You annoy me, Rattray!  You disgust me! You irritate me unspeakably!
Thank Heaven, I am a man of equable temper, or I should scarcely be able
to contain myself before your mocking visage.  --Stalky imitating Macrea