Lee, thanks for the explanation. I already know if for one level list, (2 . (1 2 3)) is same as (2 1 2 3). What I always use is the (2 . (1 2 3)) in a parent list and the parent list contains many items, normally like
((0 . "type")(1 . "value")(2 . ("text1" "text2" "text3"))(3 . (("text1" "abc")("text2" "123"))) ...)
In most situations, I just directly define the list by typing them as the contents are constant. I now just need to construct it by program and have the difficulty to do it by code.
As I discovered, for the parent list:
(cdr (assoc 3 lst))=> (("text1" "abc")("text2" "123"))
if define the parent list without the dot (by codes)
(cdr (assoc 3 lst))=> ((("text1" "abc")("text2" "123")))
It is obviously that having the dot will auto "strip" one level from the result. same as (cdr (assoc 2 '(2 . "a")))="a", (cdr (assoc 2 '(2 "a")))=("a")
The expression (2 . ("1" "2" "3")) is identical to (2 "1" "2" "3") both semantically and in the manner in which the data is retrieved by the AutoLISP list functions. In AutoLISP, lists are stored as singly linked lists whereby the contents of the address register (or car) will return the first element of the list, and the content of the decrement register (or cdr) will return the linked list which results from traversing to the next node in the link.
In the case of the dotted pair (aka ordered pair), the two elements are stored in consecutive blocks of memory, i.e. the content of the decrement register will yield the second element of the pair, as opposed to a pointer to the remainder of the linked list. However, since the second element in this case is itself a list, the dotted pair is interpreted as a linked list, as may be observed at the console -
_$
(setq l '
(2 .
("1" "2" "3")))(2 "1" "2" "3")