@lelerabi has joined the channel
Hello! Is there a keybinding for DrRacket on Windows to select all the text until the matching parentheses, starting from an open parentheses?
‘Keyboard shortcuts’ in the manual https://docs.racket-lang.org/drracket/Keyboard_Shortcuts.html
Also note > And finally, the authoritative source for keybindings is the Edit menu’s Show Active Keybindings menu item. Keybindings in DrRacket are often sensitive to the window that has the keyboard focus, so the contents of the window that Show Active Keybindings opens will depend where the keyboard focus was when the menu was selected.
also worth checking is https://docs.racket-lang.org/drracket/editor.html
thanks @spdegabrielle
Welcome to the Racket Slack :smiley:
On Mac, it’s shift+alt+right (or shift+alt+left). Could be different on Windows
Hi, I have a question about delimited continuation
in Racket. See the following code: reset/shift
: (reset (+ 1
(shift k1 (+ 3 (k1 10)))
(shift k2 (k2 100))
1000))
>> 1114
prompt/control
: (prompt (+ 1
(control k1 (+ 3 (k1 10))) ; <------ why the `(+ 3 [])` still be evaluated?
(control k2 (k2 100))
1000))
>> 1114
I can understand the reset/shift
case, but I can’t understand the prompt/control
case.
Why the prompt/control
case also returns 1114
instead of 1111
. When the (k2 100)
returns, why the control flow won’t abort to the prompt
? (It seems the (+ 3 [])
still be evaluated?) In my understanding, opposite to shift
, when control
captures a delimited continuation k
, there should be no additional prompt
embedded in that k
, right? Thanks.
Assuming I haven’t messed up somewhere in my understanding of this… In the reset
/shift
scenario, k2
becomes (lambda (v) (+ 1 10 v 1000))
and the (+ 3 _)
happens regardless of the continuation use because the call to k1
set up a reset
barrier protecting it. In the prompt/control
scenario, the call to k1
doesn’t set up a prompt
barrier, but that means k2
captures the (+ 3 _)
and becomes (lambda (v) (+ 3 (+ 1 10 v 1000)))
.
There’s no extra prompt in k1
, but the original prompt
is still there, so k2
captures (+ 3 (+ 1 10 …)))
. In other words, the difference is whether k2
captures the (+ 3 •)
part or whether the (+ 3 •)
part sits outside the part that is captured (but also outside the part that is discarded) for k2
.
So the prompt/control
, the k2
still capture (+ 3 [])
, I didn’t realize this before. Thanks @mflatt and @rokitna.
It seems that these two cases return the same result but the behaviors are different.
In the reset/shift
case, k2
capture: k2 = (λ (u)
(reset
(+ 1
10
u
1000)))
(+ 3 [])
not in k2
, because k1
has a reset
to protecting: k1 = (λ (v)
(reset ;<--- this make `k2` cannot capture `(+ 3 [])`
(+ 1
v
(control k2 (k2 100))
1000)))
In the prompt/control
case, k2
capture: k2 = (λ (u)
(+ 3 (+ 1
10
u
1000)))
Oh yeah, k2
does have a reset
in it in the first scenario. I forgot that. Your explanation looks good to me.