clojureCollections and Sequences


Syntax

  • '()()
  • '(1 2 3 4 5)(1 2 3 4 5)
  • '(1 foo 2 bar 3)(1 'foo 2 'bar 3)
  • (list 1 2 3 4 5)(1 2 3 4 5)
  • (list* [1 2 3 4 5])(1 2 3 4 5)
  • [][]
  • [1 2 3 4 5][1 2 3 4 5]
  • (vector 1 2 3 4 5)[1 2 3 4 5]
  • (vec '(1 2 3 4 5))[1 2 3 4 5]
  • {} => {}
  • {:keyA 1 :keyB 2}{:keyA 1 :keyB 2}
  • {:keyA 1, :keyB 2}{:keyA 1 :keyB 2}
  • (hash-map :keyA 1 :keyB 2){:keyA 1 :keyB 2}
  • (sorted-map 5 "five" 1 "one"){1 "one" 5 "five"} (entries are sorted by key when used as a sequence)
  • #{}#{}
  • #{1 2 3 4 5}#{4 3 2 5 1} (unordered)
  • (hash-set 1 2 3 4 5)#{2 5 4 1 3} (unordered)
  • (sorted-set 2 5 4 3 1)#{1 2 3 4 5}