@jcpLPAKD hi,
LISP is exactly the right language to hold a list of values and have wonderful functions to retrieve. cause you did not post your variables here is a general example:
(setq iA 5 iB 9 iC -3) ; intergers
(setq rA 2.50 rB 8.38 rC -7.98) ; reals
you can do the same with strings, lists, points
Now lets wrap them in list:
(setq lst '()) ; reset lst
(foreach var (list iA iB iC rA rB rC)
(setq lst (cons var lst))
)
(princ (reverse lst))
The (cons) function construct the list. As opposed to (append) function, it construct the list in reverse (each item is appended in list head, that's why at the end of the construction we use (reverse) function. the question is why we do not use (append) instead? because (cons) is very fast and in construction of big lists it's the preferable.
(car lst) ; return 5
(cadr lst) ; return 9
also (nth) function can retrieve values:
(nth 0 lst ; return 5
(nth 1 lst) ; return 9
(nth 2 lst) ; return -3
(nth 3 lst) ; return 2.50
(nth 4 lst) ; return 8.38
(nth 5 lst) ; return -7.98
as you can see the first item in lst is index 0, second is 1, third 2 and so on...
if you want to know the type of a value, use (type) function
(type (nth 2 lst)) ; returns 'INT
(type (nth 5 lst)) ; return 'REAL
and if it is a string, it will return 'STR
if it's a list, it will return 'LIST
Moshe