[plt-scheme] (no subject)

From: Daniel Yoo (dyoo at cs.wpi.edu)
Date: Thu Apr 19 18:08:44 EDT 2007

On Thu, 19 Apr 2007, Shriram Krishnamurthi wrote:

> I didn't want to say anything, but now that Danny has piped in, I might 
> as well throw in two bits: it is a *mildly* interesting exercise, 
> depending on how you choose to model Basic.  Remember that the key is to 
> support numbered lines with GOTO and GOSUB.
> One option is to just map each line number to a label, treat the whole 
> thing as one big LETREC, and have it shut with.
> But if you really want to have fun, then you should treat each GOTO as a 
> continuation invocation.

Sorry, I couldn't resist asking: would the second option look something 
like this?

(module test-cc mzscheme
   ;; Trying to encode the spirit of
   ;; 20 GOTO 10
   ;; using Scheme's continuations.

   (let ([line-10 #f] [line-20 #f])
     (let/cc k (set! line-10 k))
     (printf "hello world\n")
     (let/cc k (set! line-20 k))
     (line-10 #f)))

Posted on the users mailing list.