You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
The text was updated successfully, but these errors were encountered:
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 aset!
. So the call/cc could just be capturing theset!
part of thedefine
, in which case the fact that the value mutates is not surprising. (You can't observe this without acall/cc
because the two things happen together and only once.)Put differently, I think you should just focus on why this is not erroring:
The text was updated successfully, but these errors were encountered: