[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
top level definitions
I like the wrap-it-all-with-a-let semantics for top-level definitions.
However, note that this is not in keeping with R3RS, in that it disallows
such programs as
(define pi 3.14159)
(define radius 10)
(define circumference (* 2 pi radius))
[Abelson and Sussman, p. 8], which would be legal under R3RS's set!-like
semantics for top-level definitions.
Of course, you could patch things up by switching from letrec to letrec*.
My preference is to adopt the letrec-based version as official (making the
above example not standard scheme), with the letrec*-based version as an
incouraged extension for interactive implementations (note that letrec*
is a legal implementation of letrec, as remarked in R3RS).
There is also an issue of what to do with multiple definitions of the
same variable in the same scope, which R3RS doesn't address for
internal definitions and is a bigger issue for top-level interactions.
Again, it's probably best to make any use of this feature
non-standard, with some encouraged extension for interactive