At Tue, 19 May 2015 20:33:57 -0700, Alexis King wrote: > As I've continued to experiment with this, I've run into something that I > don't > really understand. I've managed to come up with this snippet of code. > > (define (do prompt-tag) > (define (loop element continue) > (if continue > (+ element (call-with-continuation-prompt continue prompt-tag loop)) > element)) > (call-with-continuation-prompt > (thunk > (for/fold () ([i (in-range 10)]) > (let/cc continue > (abort-current-continuation prompt-tag (let () i) continue))) > (abort-current-continuation prompt-tag 0 #f)) > prompt-tag loop)) > > (do (default-continuation-prompt-tag)) > (do (make-continuation-prompt-tag)) > > The first of the two calls at the end returns 45, but the second returns 0. > Why > does using a non-default prompt tag change the behavior if I'm installing my > own prompt anyway?
There's a `(default-continuation-prompt-tag)` lurking in `let/cc`. If you change it to use `call/cc` and pass `prompt-tag` as the second argument to `call/cc`, then you'll get the result that you expected. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.