webguy08 wrote:How would I make it understand that I want it to change the global variable? Do I have to use defvar, or defparameter?
You use
DEFPARAMETER once to
declare that the variable is global and then change it. But operating on global variables directly, even if they are convenient for testing, is usually bad, for reasons which are not language specific.
webguy08 wrote:After coming from object-oriented languages this sure is very different
It is not really. You are just for some reason doing things in most weird way possible, and in any case, in addition to what nuntius said, it is exactly the same in Python:
Code: Select all
>>> gameList=['a','b','c']
>>> gameList
['a', 'b', 'c']
>>> def addToList(l):
... l=l+['d']
...
>>> addToList(gameList)
>>> gameList
['a', 'b', 'c']
and in any language with value-passing semantics, which most 'object-oriented' languages are.
In any case, as I pointed out in the very first reply, that Lisp most certainly has
objects, and you should be using them.