jkaczo...@aol.pl wrote at 10/31/2011 12:58 PM:
Of course, I realize, that redefinition of the variables is not good (functional) programming style but sometimes it's necessary. Is there a possibility of such modifications without changing language?

You might wish to use a parameter, like in the example below.


#lang racket

(define current-counter (make-parameter 0))

(current-counter)  ;==> 0

(current-counter 42)

(current-counter)  ;==> 42

(current-counter (+ 1 (current-counter)))

(current-counter)  ;==> 43


In this example, I have named your variable to start with "current-", just by convention to emphasize that a variable is a parameter, but that's not actually necessary.

--
http://www.neilvandyke.org/
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to