[plt-scheme] Problem with (... ...) pattern
Hi all,
I am trying to write a formals-arity procedure that
given a syntax-object representing the formals (formal arguments)
of an abstraction returns the arity. The arity of a function
receiving 3 or more arguments are -3.
> (formals-arity #'(a b c))
3
> (formals-arity #'(a b c ...))
-3
I tried this definition:
(define (formals-arity stx)
(syntax-case stx ()
[(a ... (... ...))
(- (length (syntax->list #'(a ... ))))]
[(a ...)
(length (syntax->list stx))]
[else
(error 'formals-arity "not-yet implemented arity for " stx)]))
Alas, I get the error:
syntax: missing ellipses with pattern variable in template in: a
and the a in #'(a ...) is colored red.
Shouldn't have worked? Am I missing something?
--
Jens Axel Søgaard