Shu-hung, very cool information.
Em qui, 25 de out de 2018 às 16:57, Shu-Hung You <
shu-hung@eecs.northwestern.edu> escreveu:
> FWIW here's the part in the document that could be helpful:
>
> 1. The section in the Guide that talks about the concept of prompts
> and their usage in the continua
FWIW here's the part in the document that could be helpful:
1. The section in the Guide that talks about the concept of prompts
and their usage in the continuation in Racket:
https://docs.racket-lang.org/guide/prompt.html
The prompt is kind of like a mark on the continuations that lets the
control
About (+ 1 (prompt (* 2 (call/cc (lambda (k) (set! x k) 2)
1. "prompt" form does not exist in racket.
It is a procedure application or special form ?
2. assume this procedure or special form exists to construct a prompt.
(+ 1 (prompt (* 2 (call/cc (lambda (k) (set! x k) 2)
After the (
well, let's go by parts :
1) call/cc in principle will capture the complete continuation of a
expression, right? Delimited continuation will capture ... welll, delimited
continuations. But delimited by what? By a prompt.
In a delimited contninuation style(not really, but I dont want to mix
functio
Thank Joao
I change my code like this:
#lang racket
((lambda ()
(define saved-k #f)
(println (+ 1 (call/cc
(lambda (k) ; k is the captured continuation
(set! saved-k k)
0
(println 'hello)
(saved-k 100)
))
Now it works as I expected.
But why?
Well, call/cc is like (in racket) delimited continuation, and have a
implicit prompt around a s-exp, so, as begin is a macro, he don't create a
prompt. The continuation captured is (+ 1 []) in your example.
If you change the begin to a let, this works, because let expand to a
application of a lamb
Dear all,
I am learning call/cc in racket, so I wrote some experiment code:
#lang racket
(begin
(define saved-k #f)
(+ 1 (call/cc
(lambda (k) ; k is the captured continuation
(set! saved-k k)
0)))
(println 'hello)
(saved-k 100)
;; why 'hello not print m
7 matches
Mail list logo