Ehsan wrote:Hi every . i have question about cons in lisp . how can i make this list
(1 (4 9 (12) ))
i used this rule (cons 1 (cons (cons 4 (cons 9 (cons (cons 12()))) ()) ())) but interpreter return error
(list 1 (list 4 9 (list 1 2)))
(cons 1(cons (list 4 9 (list 1 2)) NIL))
nuntius wrote:I think the main issue is that the empty list must be written as '(). If you write (), then it will try to evaluate the function with no name.
nuntius wrote:In Common Lisp, '() can also be written as nil.
Users browsing this forum: No registered users and 1 guest