Skip to content

syntax-rules does not support patterns beginning with ellipsis, like (... ...) #704

@jpellegrini

Description

@jpellegrini

Hi @egallesio - happy holidays!

In page 24 of R7RS, the specification of patterns for syntax-rules contains this:

A template of the form (<ellipsis> <template>) is identical to <template>, except that ellipses within the template have no special meaning. That is, any ellipses contained within <template> are treated as ordinary identifiers. In particular, the template (<ellipsis> <ellipsis>) produces a single <ellipsis>. This allows syntactic abstractions to expand into code containing ellipses.

(define-syntax be-like-begin
  (syntax-rules ()
    ((be-like-begin name)
      (define-syntax name
        (syntax-rules ()
          ((name expr (... ...))
            (begin expr (... ...))))))))

(be-like-begin sequence)
(sequence 1 2 3 4)      ;; => result should be 4

But in STklos this raises an error when using the macro:

stklos> (be-like-begin sequence)
**** Error:
map: malformed list '#f'
	(type ",help" for more information)

I'll take a look into this, probably before the beginning of 2025 -- but I wanted to report the issue already.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions