@Sea-Haven wrote:
.... I always declare an empty list then just cons to it.
It really accomplishes nothing to start with an empty list, because an empty list does not exist:
Command: (setq what '())
nil
and if I check for what the list contains, if anything:
Command: !what
nil
[not '() as was originally given to it].
and if I ask for what kind of thing it is:
Command: (type what)
nil
not what you get for one that does exist:
Command: (type VariableContainingList)
LIST
It may "look like" a list with nothing in it exists, if you ask for how many items are in it:
Command: (length what)
0
But that's what it returns for any nonexistent list:
Command: (length MarilynMonroe)
0
So you can just start a list without its existing ahead of time, by the putting of the first thing into it [here with the 'lst' variable not yet existing], either with (cons):
Command: (setq pt (getpoint))
(16.3829 3.24624 0.0)
Command: (setq lst (cons pt lst))
((16.3829 3.24624 0.0))
or with (append):
Command: (setq lst (append lst (list pt)))
((16.3829 3.24624 0.0))
EDIT: WHICH MEANS that the (fListAddPoint) function in Messages 1 & 5 has no need to check whether the 'aPointsList' variable exists. Whether it does or not, it can do simply this line:
(setq aPointsList (append aPointsList (list aPoint)))
Kent Cooper, AIA