Why lists created with cons() and list() are shown differently despite the lists are equal? The first one shows items separated by dot, but second one do w/o.
> (cons 1 2)
(1 . 2)
> '(1 2)
(1 2)
I know that cons constructs dotted pair, but in this case the lists are same but shown differently.
To expand on Basile’s answer:
is a proper list of length two. That is, it contains two cons cells:
On the other hand,
is an improper list of length one. That is, it contains one cons cell:
A non-empty proper list is a list where the last cons cell’s
cdrthat contains the empty list,(). A non-empty improper list is a list where the last cons cell’scdrcontains anything else.