Types - oliyh/learning-clojure GitHub Wiki

Clojure has a few fundamental types, most of which should be familiar to you if you are coming from Java. You can check the type of anything by using the type function, e.g. (type 1) returns java.lang.Long.

Primitives

  • 1 -- A long
  • 2.0 -- A double
  • \a -- a character
  • "abc" -- a string
  • :a -- a keyword (like an interned string)

Collections

  • [1 2 3] -- A vector (like an ArrayList)
  • '(1 2 3) -- A list (like a LinkedList)
  • #{1 2 3} -- A set (like a HashSet)
  • {:a 1} -- A map (like a HashMap)