[plt-scheme] (no subject)
Try adding function definition (and call).
Robby
On 4/19/07, Daniel Yoo <dyoo at cs.wpi.edu> wrote:
>
>
> 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
> ;;
> ;; 10 PRINT "HELLO WORLD"
> ;; 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)))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>