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

REPL / Continuation weirdness #87

Open
schanzer opened this issue May 20, 2024 · 0 comments
Open

REPL / Continuation weirdness #87

schanzer opened this issue May 20, 2024 · 0 comments

Comments

@schanzer
Copy link
Member

schanzer commented May 20, 2024

From @shriram

So one of the things you have to be really careful about when running these programs is understand where you're running them from. Running from an editor is not exactly the same as running from the REPL! That's because the "continuation" is the entire rest of the computation; in the REPL each REPL prompt is an end of a computation, whereas in the editor, clicking Run includes all the rest of the body as well (which the REPL can't "see" when you enter things a line at a time).

In your first program, note that if I enter the lines one by one in the REPL, it does not print out anything.

Keep in mind that define can also be thought of as a two-step operation: one that introduces the name with a dummy value, the other of which is a set!. So the call/cc could just be capturing the set! part of the define, in which case the fact that the value mutates is not surprising. (You can't observe this without a call/cc because the two things happen together and only once.)

Put differently, I think you should just focus on why this is not erroring:
image

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

1 participant