On 21 Oct 1997 David Fox wrote:
> There is some disagreement about what define means when it is not
> at the top level.
There shouldn't be, at least regarding top levels. From R4RS:
"A <body> containing internal definitions can always be con-
verted into a completely equivalent letrec expression."
This precludes changing the top-level with an internal definition.
The only vagueness I see, based on a quick experiment with STk, Bigloo,
and MzScheme, is the handling of internal definition interspersed with
non-definition forms. MzScheme rejects these, but they COULD be thought
as nested letrecs. I.e. each letrec gathers a clustered sequence of
definitions.
E.g.
(define (x n)
(define (y n) (+ n 3))
(define (z n) (* 3 n))
(set! foo 'bar)
(define (a n) (- 15 n))
(define (b n) (/ n 24))
(a (b (x (y n)))))
=>
(define (x n)
(letrec ((y (lambda (n) (+ n 3)))
(z (lambda (n) (* 3 n))))
(set! foo 'bar)
(letrec ((a (lambda (n) (- 15 n)))
(b (lambda (n) (/ n 24))))
(a (b (x (y n)))))))
I don't see anything to support this or reject this though.
Thoughts,
--
Christopher Oliver Traverse Communications
Systems Coordinator 223 Grandview Pkwy, Suite 108
oliver_at_traverse.com Traverse City, Michigan, 49684
"You can even make Emacs look just like vi -- but why?" - C. Musciano
Received on Tue Oct 21 1997 - 19:25:34 CEST