[racket] syntax-case and multiple ellipsis

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Jun 17 14:04:44 EDT 2014

Hi Spencer,

The problem is that syntax-case pattern doesn't allow allow
pattern of the form (x ... y ...) that is with two ellipsis on the
same level.

Luckily syntax-parse allow these:

(require syntax/parse)

(syntax-parse #'(a a a a 41 42 43)
  [(c ... d ...)
   #''((c ...) (d ...))])

(syntax-parse #'(a a a a 41 42 43)
  [(c:id ... d ...)
   #''((c ...) (d ...))])


/Jens Axel




2014-06-17 19:46 GMT+02:00 Spencer Florence <florence at northwestern.edu>:
> Hey all,
>
> I'm trying to write a macro with syntax-case that looks something like this:
>
>  (syntax-case stx (in def)
>     [(_ name
>         (def a ...) ...
>         (in clause do ...) ...)
>      stuff])
>
> But, this gives me the error "syntax-case: misplaced ellipsis in pattern
> (follows other ellipsis)" on the last ellipsis. Does anyone know a way
> around this?
>
> --spencer
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>



-- 
--
Jens Axel Søgaard


Posted on the users mailing list.