Re: [Scheme-reports] Question regarding interaction between new syntax-rules extensions John Cowan (25 May 2013 17:30 UTC)

Re: [Scheme-reports] Question regarding interaction between new syntax-rules extensions John Cowan 25 May 2013 17:30 UTC

Peter Bex scripsit:

> (define _ 'underscore)
> (define-syntax match-ellipsis-underscores
>   (syntax-rules _ ()
>       ((x a _ c) (list a _ c))))
>
> (match-ellipsis-underscores 1) => (1), or error?

Chibi says (1).

> (match-ellipsis-underscores 1 2 3) => (1 underscore 3), or (1 2 3)

Chibi says (1 2 3)

> (match-ellipsis-underscores 1 2 3 4 5 6) => (1 2 3 4 5 6) or error?

Chibi says (1 2 3 4 5 6)

> (define ___ 2)
> (define-syntax match-ellipsis-literals
>   (syntax-rules ___ (___)
>     ((_ x ___) (list x ___))))
>
> (match-ellipsis-literals 1) => (1 2), (1 underscore), or (1)?

Chibi says: error, no expansion

> (match-ellipsis-literals 1 2) => (1 2), (1 underscore), or error?

Ditto.

> (match-ellipsis-literals 1 ___) => (1 underscore), error?

Chibi says (1 2)

Make of all that what you will.

--
John Cowan    cowan@ccil.org    http://ccil.org/~cowan
Heckler: "Go on, Al, tell 'em all you know.  It won't take long."
Al Smith: "I'll tell 'em all we *both* know.  It won't take any longer."

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports