[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: scheme@mc.lcs.mit.edu*Subject*: Re: Internal definitions as a combination of LETREC's and LET*'s.*From*: pierce@locus.ucla.edu (Brad Pierce)*Date*: Mon ,31 Oct 88 22:14:24 EDT*Organization*: UCLA Computer Science Department*References*: <41415@linus.UUCP>*Sender*: scheme-request@mc.lcs.mit.edu

In article <41415@linus.UUCP> ramsdell@linus.UUCP (John D. Ramsdell) writes: >Yet at top level, it is okay to define values in terms of other >definitions. An obvious way of making internal definitions behave >more like top level definitions, is to specify the order in which the >init bodies are evaluated. I call this interpretation internal >definitions as a combination of LETREC's and LET*'s; a definition >becomes equivalent to the following combinations of LET's and SET!'s: > >(LET () > (DEFINE <var-0> <init-0>) > ... > (DEFINE <var-n> <init-n>) > <body>) > ==> >(LET ((<var-0> <undefined>) > ... > (<var-n> <undefined>)) > (SET! <var-0> <init-0>) ; init's must be evaluated > ... ; in the order presented. > (SET! <var-n> <init-n>) > <body>) > Here's one possible problem, at least with the suggested expansion: (define x 5) (let () (define y x) (define x 'any) y) Then wouldn't the result be unspecified, even though the intuitive answer is 5? -- Brad Pierce P.S. Something else I'm curious about... Also, is one allowed to declare the same identifier more than once in the same lambda closure in official Scheme? The Scheme I am currently using doesn't give an error message when I try to do this: ((lambda (x x) x) 1 2) And is it officially legal to "define" something more than once at top level. The reason that I ask is that the expansion looks a little shaky in the case that one would re"define" an identifier in such a clause.

**Follow-Ups**:**Declaring variables more than once***From:*uoregon!will@beaver.cs.washington.edu (William Clinger)

**References**:**Internal definitions as a combination of LETREC's and LET*'s.***From:*linus!ramsdell@gatech.edu (John D. Ramsdell)

- Prev by Date:
**Internal definitions as a combination of LETREC's and LET*'s.** - Next by Date:
**Digest test, ignore** - Previous by thread:
**Internal definitions as a combination of LETREC's and LET*'s.** - Next by thread:
**Declaring variables more than once** - Index(es):