On Thu, 5 Apr 2007 08:47:02 +0000 (UTC), Nils M Holm
Additionally, implicit defines do not work in compiled code and may
>> Is there any good reason that "define" shouldn't double as "set!"?
>Yes: DEFINE defines variables, SET! changes the values of (defined)
>(set! x 1) => wrong!
>(define x 0)
>(set! x 1)
>x => 1
>Some interpreters may implicitly define variables when you try
>to set! them for the first time, thereby making DEFINE and SET!
>/appear/ to be the same.
work only at the top level in an interpreter.
Within a function, setting a variable that hasn't been declared (at
the top level using define, in a lambda list or in a let) will fail if
the function is compiled and may fail if the function is interpreted.
(define x 0)
(define (f z)
(let ((w 0))
(set! w 1)
(set! x 1)
(set! z 1)
(set! y 1)))
set!: cannot set undefined identifier: y
So, it may work in some situations, but don't count on it.
for email reply remove "/" from address