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

Fix env issue #4

Closed
eigenhombre opened this issue Jul 19, 2022 · 3 comments
Closed

Fix env issue #4

eigenhombre opened this issue Jul 19, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@eigenhombre
Copy link
Owner

eigenhombre commented Jul 19, 2022

See https://github.com/eigenhombre/smallscheme/blob/master/smallscheme/scheme.py#L242

Get more tests for closures, etc. and make sure environments and nesting of same work correctly.

@eigenhombre
Copy link
Owner Author

Failing test:

 ;; Lexical closures:
 (define a 3)
 (define (f) (+ 1 a))
 (is (= 4 (f)))
 (define a 4)
 ;; Fails, Issue 4:
 ;; (is (= 4 (f)))

@eigenhombre
Copy link
Owner Author

Scratch that - looks like I don't understand scope in Scheme:

Welcome to Racket v8.5 [cs].
>  (define a 3)
 (define (f) (+ 1 a))
 (= 4 (f))
 (define a 4)
 (= 5 (f))
> > #t
> > #t
>

@eigenhombre
Copy link
Owner Author

Instructive test case at https://stackoverflow.com/questions/526082/

eigenhombre added a commit that referenced this issue Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 21, 2022
@eigenhombre eigenhombre added the bug Something isn't working label Jul 21, 2022
eigenhombre added a commit that referenced this issue Jul 22, 2022
eigenhombre added a commit that referenced this issue Jul 22, 2022
eigenhombre added a commit that referenced this issue Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant