On Sep 17, 2009, at 12:04 AM, Brian Mastenbrook wrote:

> You could imagine the REPL in this model as an ever nested
> sequence of LET forms:
>
> (let ()
>   *first user input here*
>   (let ()
>     *second user input here*
>       (let ()
>         *third user input here*
>         ...)))
>
> In this case, all of the bindings returned by any individual form
> entered at the REPL are established in parallel, and multiple
> individual forms establish bindings sequentially.

Ikarus does this pretty much (which some would consider broken, so,
spare me!).  There is only two minor things it does differently:

1. If *user input here* contains a reference to an unbound variable
(in any outer scope), it does what amounts to injecting a dummy
definition to that variable giving it some #<unbound> value.

2. If *user input here* contains a new definition of a variable
that was previously defined in the repl, the definition is turned
into a set!.

So, if you type:
   (define (f) --- g ---)
   (define (g) --- f ---)
that would be equivalent to:
(let ()
   (define g)
   (define (f) --- g ---)
   (let ()
     (set! g (lambda () --- f ---))
     (let ()
        ...)))
while typing:
(begin
   (define (f) --- g ---)
   (define (g) --- f ---))
is equivalent to:
(let ()
   (define (f) --- g ---)
   (define (g) --- f ---)
   (let ()
     ...))

I believe Chez Scheme (7.9) and Larceny (0.97, in "err5rs" mode)
both do what amounts to the same thing.

Aziz,,,

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to