On Jun 28, 2009, at 12:07 AM, Handkea fumosa wrote:
user=> (list? '(1 2 3)) true user=> (list? (cons 4 '(1 2 3))) false
user=> (doc cons) ------------------------- clojure.core/cons ([x seq]) Returns a new seq where x is the first element and seq is the rest. nil user=> (cons 4 '(1 2 3)) (4 1 2 3) user=> (seq? (cons 4 '(1 2 3))) true user=> (first (cons 4 '(1 2 3))) 4 user=> (rest (cons 4 '(1 2 3))) (1 2 3) user=> (list? (rest (cons 4 '(1 2 3)))) true user=> cons is acting according to its documentation.Some of the roles played by lists in other Lisps are played by seqs in Clojure. Also, in Clojure a list is not a linked list of cons cells. Roughly speaking, a Clojure list is a linked list of lists:
user=> (list? (rest (rest (rest '(1 2 3 4 5 6 7))))) true --Steve
smime.p7s
Description: S/MIME cryptographic signature