Why "(cons '(a b) '(c d))" evaluates to "((a b) c d)" ?

Yet another explanation attempt:

A cons cell consists of car and cdr and is written as (car . cdr). Note the dot between car and cdr.

A (normal) list consists of multiple cons cells, which are chained together.
I.e. The cdr of a cons cell is always replaced by the following cons cell. The last cons cell has a cdr of nil.
This is expressed as '(a . (b . (c . nil))) or short '(a b c).

So from your example: '(a b) means '(a . (b . nil)) and '(c d) means'(c . (d . nil))`.

The function cons constructs a new cons cell by using the first argument as car and the second argument as cdr. So (cons 'x 'y) becomes '(x . y).

Therefore: (cons x y) while x equals to '(a . (b . nil)) and y equals to '(c . (d . nil)), becomes (x . y) which is '((a . (b . nil)) . (c .(d .nil))) which can also be expressed as '((a b) . (c .(d . nil))) or '((a b) c d)

/r/emacs Thread