[plt-scheme] Comments on an alternate syntax for let?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue Apr 8 14:29:44 EDT 2008

The top-level definitions in a module are like the internal
definitions. Unless you're talking about the top-level outside a
module. And there, I'll just repeat Matthew's advice/diagnosis: it's
horribly broken. Avoid it.

Robby

On Tue, Apr 8, 2008 at 11:50 AM, Majorinc, Kazimir <kazimir at chem.pmf.hr> wrote:
>
>
> > (let ()
> >  (define x 1)
> >  (define y 6)
> >  (let ()
> >    (define x (add1 x))
> >    (define y (sub1 y))
> >    (+ x y)))
> > add1: expects argument of type <number>; given #<undefined>
> >
>  I see. Internal defines behave like they are the binding parts of letrec,
> top level defines like they are the binding parts of let*.
>
>  (define x 1) (define x (add1 x))
>  (define y (add1 x))
>  (+ x y)
>
>  is equivalent to
>
>  (let* ((x 1)
>       (x (add1 x))
>       (y (add1 x)))
>      (+ x y))
>
>  Am I right?
>
>  It complicates writing macros that use define, because they should work on
> both levels. Is it possible to separate the functionalities lumped together
> in define and various lets into something like
>
>  (bind x)
>  (assign x ...)
>  (scope ...)
>  (sequentially ...)
>  (simultaneously ... )?
>
>  We already have assign = set!, scope = let(), sequentially = begin. Is
> there something in PLT that can be used for "simultaneously" and "bind"?
>
>
>  _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.