Consing To Inside A Global Variable
Consing To Inside A Global Variable
Hullo. Noob here. I'm trying to stick a symbol deep inside a global variable. I'm writing a function to do it for me, but I can't figure out how to stick a symbol inside a global variable… what I have currently is a defparameter defining a variable as itself consed to something… but this is a top-level cons. How do I cons to deeper levels?
Re: Consing To Inside A Global Variable
Typically for non-trivial application you would use a proper datastructure, since conses are somewhat finicky and best treated as immutable. See for example Practical Common Lisp for use of arrays and objects.
Also I do not really understand what you mean. Variables are bound to objects, "stick a symbol deep inside a global variable" doesn't really mean anything. If you want to add a symbol to some object, the that object being pointed to by a global variable is irrelevant. If you mean that you have a variable pointing at a cons structure which shares structure with something else, then don't do it if you intent to mutate anything.
Also I do not really understand what you mean. Variables are bound to objects, "stick a symbol deep inside a global variable" doesn't really mean anything. If you want to add a symbol to some object, the that object being pointed to by a global variable is irrelevant. If you mean that you have a variable pointing at a cons structure which shares structure with something else, then don't do it if you intent to mutate anything.