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

Don't make named let as letrec #341

Closed
jcubic opened this issue Mar 17, 2024 · 1 comment
Closed

Don't make named let as letrec #341

jcubic opened this issue Mar 17, 2024 · 1 comment
Milestone

Comments

@jcubic
Copy link
Collaborator

jcubic commented Mar 17, 2024

This is known bug in LIPS:

(test.failing "std: Petrofsky let"
      (lambda (t)
        (t.is (let - ((n (- 1))) n) -1)))

It's because this named let expands into:

(letrec ((- (lambda (n) n))) (- (- 1)))

But this was a lazy implementation to not have to implement named let in JavaScript like other let expressions.

Test created in 2022-05-31 (according to git blame)

@jcubic jcubic added this to the 1.0 milestone Mar 17, 2024
@jcubic
Copy link
Collaborator Author

jcubic commented Mar 17, 2024

The solution is to create a list of initial arguments outside of let:

(let ((#:args (list (- 1))))
  (letrec ((- (lambda (n) n)))
    (apply - #:args)))

jcubic added a commit that referenced this issue Mar 17, 2024
@jcubic jcubic closed this as completed Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant