[plt-scheme] The Scheme way of: Using 'global' variables ?
On Sun, Aug 16, 2009 at 4:23 PM, Matthias Felleisen<matthias at ccs.neu.edu> wrote:
>
> If you like this:
>
> On Aug 16, 2009, at 3:03 PM, Amit Saha wrote:
>
>>> (define the-function
>>> (let ((the-variable 0))
>>> (lambda (operation . values)
>>> (case operation
>>> ((set) (set! the-variable (car values)))
>>> ((display) (display the-variable))))))
>>> (the-function 'display) ;; => 0
>>> (the-function 'set 11)
>>> (the-function 'display) ;; => 11
>
>
> use classes instead:
>
> It really scales. -- Matthias
Except to other Schemes.
The module solution is a good one.