< gigamonkey> Say you were running a genetic algorithm and you
said (defparameter *populations* nil)
< gigamonkey> Then you run it for a few days and *populations*
is full of thousands of populations you've
generated. Then you change some code in the file
and reload it. Ooops. You've just wiped out your
*populations*.
< gigamonkey> (defvar *populations* nil) saves you from that.
< gigamonkey> Conversely if you have
(defvar *mutation-rate* .01) and then you decide
to tweak things and change the .01 to .001 and
reload the file, you'll be confused when nothing
changes.
< gigamonkey> In that case you should have used defparamater.
< gigamonkey> spelled right, of course.
Thursday, June 11, 2009
When to use defparameter and defvar
Because I always forget:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment