Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in tspl for make-variable-transformer #721

Open
gwatt opened this issue Sep 25, 2023 · 1 comment
Open

Error in tspl for make-variable-transformer #721

gwatt opened this issue Sep 25, 2023 · 1 comment

Comments

@gwatt
Copy link
Contributor

gwatt commented Sep 25, 2023

https://scheme.com/tspl4/syntax.html#./syntax:s42

The given example is missing set! in the syntax-case literal list:

(let ([ls (list 0)])
  (define-syntax a
    (make-variable-transformer
      (lambda (x)
        (syntax-case x ()
          [id (identifier? #'id) #'(car ls)]
          [(set! _ e) #'(set-car! ls e)]
          [(_ e ...) #'((car ls) e ...)]))))
  (let ([before a])
    (set! a 1)
    (list before a ls))) ⇒ (0 1 (1))

As-is, any form like (a _ _) will result in a set! form.

@mml
Copy link

mml commented Dec 10, 2024

Indeed! I wonder if @dybvig is still updating the errata?

Chez Scheme Version 10.1.0
Copyright 1984-2024 Cisco Systems, Inc.

> (define ls (list 0))
> (define-syntax a
        (make-variable-transformer
          (lambda (x)
            (syntax-case x ()
              [id (identifier? #'id) #'(car ls)]
              [(set! _ e) #'(set-car! ls e)]
              [(_ e ...) #'((car ls) e ...)]))))
> (a 'foo 'bar)
> ls
(bar)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants