Lists - sorokod/Clojure-Notes GitHub Wiki

Slow random access (linked list)

(list 1 2 3)   ; (1 2 3)
'(1 2 3)       ; (1 2 3) - quoting

Basic operations first rest last and cons

(def lst '(1 2))

(first lst)    ; 1  - nil if lst empty
(last  lst)    ; 2  - nil if lst empty

(rest  lst)    ; (2) - () if empty

(cons 0 lst)   ; (0 1 2)
(cons nil nil) ; (nil)