Ok, I suppose I should offer just one quick bit of information on how AutoLISP manages its' variables, more aptly those localized variables.
Once you define an application globally, when the calling program exits, the command stays bound and maintains the ability be called by any subsequent application, that is why it is global in nature. The program is available to the entire memory structure and not simply the program utilizing that code.
On the other hand if you define a function as local, it is defined within the confines of that wrapper function alone. IF there is a value already bound to that variable, then the current value it pushed and the new value as set. When the wrapper function completes successfully, the localized value is popped and the variable returns to it's global value.
There is no way to access a localized variable (if it is indeed declared as localized) unless you are operating within the confines of the wrapper function.
To test this scenario, try this:
(defun WHAT_AM_I ()
(alert "I am a global function")
)
Now at the command line when you enter
(WHAT_AM_I)
You will get an alert telling you that it is a global function.
Now do this in the same drawing
(defun C:WRAPPER ( / WHAT_AM_I)
(defun WHAT_AM_I ()
(alert "I am a local function")
)
(WHAT_AM_I)
)
Now at the command line type
WRAPPER
You will get an alert telling you that it "I am a local function"
NOW before doing anything else type
(WHAT_AM_I)
You will get an alert that states:
"I am a global function"
Clearly the function WRAPPER defun'd the new command WHAT_AM_I , but because it was localized it goes the way of all localized variables and is discarded when the wrapper function completes.
LISP was never intended to be an OOP language and as such it is not, you must bear in mind that localized functions have been around long before OOP was conceived. Try looking back at some true C programming or other non-OOP languages.
So, in theory they are not available to outside programs, nor are they available in reality.
If you understand the way assembly uses push and pop then you will understand how lisp accomplishes this feat. It is nothing more than a stack with the most current value on top (push -ing the old value down), then when the program no longer needs it, (because it has exited) it is removed (pop -ed off the stack, exposing the previous value).
That is why so many people have problems with recursive functions because they do not understand how the variables are stored and retrieved.