Let's say I have the following list: (A B . D)
.
How I would reproduce this only by using list function ?
(list 'A 'B '. 'D)
is not working.
You cannot. The constructor to create lists are cons
. Proper lists are just the empty list or a chain of one or more cons
where the last one has the empty list as the cdr
. list
only creates proper lists. Eg.
(list 'a 'b 'c)
is a function that does (cons 'a (cons 'b (cons c '())))
.
(a b . d)
is created with (cons 'a (cons 'b 'd))
. It is not a proper list since it is terminated by d
and not nil
. Thus it is impossible to create this structure with list
.