I’m doing more interactive development with the REPL lately, and I have a section of code that pushes a symbol onto a global dynamic variable (a list data structure). Problem is, I find myself repeatedly reloading the file that pushes that symbol onto the global, so each time I reload, I get another duplicate symbol pushed onto the list.
I’d like for the push operation to be done only once for each lisp session, regardless of the number of recompiles/reloads, to mimic how things will behave in a more traditional/deployed environment, when I load the code only once for a lisp session.
Here’s the method I’m using now. I hope there’s a better way….
(defvar *do-only-once*
(progn
(push 'some-val *some-global-lst*)
'evaled))
I would just use PUSHNEW instead.