|
|
|
|
|
by Xurinos
4797 days ago
|
|
The closest Clojure has to car/cdr is first/rest. It supports "cons" but only for creating sequences. Traditional Lisp car/cdr is one-location/other-location, and its cons puts together pairs of data. Often this is used for constructing sequences, but it is also often used for trees. Clojure: user=> (cons 3 4)
IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:494)
user=> (cons 3 '(4))
(3 4)
Common Lisp: CL-USER(1): (cons 3 4)
(3 . 4)
CL-USER(2): (cons 3 '(4))
(3 4)
CL-USER(3):
|
|