[plt-scheme] Changing the value of an variable
Using 'define' to change a value only works at the REPL -- not in a
function, or in a module. You probably want to use 'set!', as in
'(set! a n)'. It works (just about) anywhere.
--Carl
On Sat, Apr 25, 2009 at 4:09 PM, Matthias Redies
<rediesmatthias at yahoo.de> wrote:
> I want to change the value of an variable. Until now I've always done it by
> '(define a 4)'
> but in this doesn't work in the following code:
> '(define a 3)
> (define (test n) (define a n))'
>
> Which command should I use instead? Sry if this question seem very silly,
> but I didn't find the answer any where.
>
>
> Mfg Matthias Redies