say, common lisp.

1) what is exactly cons doing (dot or no dot)?
see
http://en.wikipedia.org/wiki/Cons
which is very clear!

strictly speaking, cons append list
========================================
cons: create a new list whose car is 1st arg, cdr is 2nd arg, no special work is taken for nil ending.
[4]> (cons ‘a ‘b)
(A . B)

[1]> (cons ‘a (cons ‘b nil))
(A B)

[2]> (setq l1 ‘(a b))
(A B)
[3]> (setq l2 ‘(c (d e)))
(C (D E))
[4]> (cons l1 l2)
((A B) C (D E))

list=========================================
list simply put all

Advertisements