[racket] begin vs +

From: Keiko Nakata (keiko at kurims.kyoto-u.ac.jp)
Date: Mon Aug 2 09:23:29 EDT 2010

Hi,

From: Matthew Flatt <mflatt at cs.utah.edu>

> At Mon, 02 Aug 2010 21:54:54 +0900 (JST), Keiko Nakata wrote:
> > Why this code 
> > 
> > (let ([d (box #f)] [a (box 0)])
> >   (print (+ (begin (let/cc k (begin (set-box! d k) (set-box! a 2) 3))) (unbox 
> > a)))
> >   ((unbox d) 9))
> > 
> > prints 511111111, rather than 59999999?
> 
> I'm not sure I'm following. Can you say more about why you expect
> infinite "9"s instead of infinite "11"s?

I wanted to undo the assignment (set-box! d k), but I think I am confusing.
I'm a novice to continuations...

I used begin to enforce sequentiality, but seemed to be trapped by it.

(And eventually I wanted to undo force-ing delayed variables using call/cc...)

Keiko



Posted on the users mailing list.