Clojure Punctuation



Symbol Name Description Example
_ Underscore Placeholder for unused
function arguments
(dotimes [_ 5] (swap! s-atom s-func))
. Dot Used for Java interop (.indexOf "caterpillar" "pillar")
@ At Sign Used to dereference refs (def some-data (ref 3))
( Parentheses Used for functions (println "hello")
'( Single-quote
and Parentheses
Used for lists (def list-of-numbers '(1 2 3))
[ Bracket Used for vectors (def vector-of-numbers [1 2 3])
{ Brace Used for maps (def map-of-numbers {:one 1 :two 2 :three 3})
#{ Pound sign and brace Used for sets (def set-of-states #{"AL" "IL" "TX"})
: Colon Keyword.
Common use:
a string used for map keys
(def map-of-numbers {:one 1 :two 2 :three 3})
#( Pound sign
and parantheses
Shorthand for
anonymous functions
(map #(+ % 3) some-vector)
#" Pound sign
and double quote
Regular expression #"(.+):(.+)"
% Percent sign Unnamed argument
to an anonymous function
#(println %)
; Semicolon Comment ; comments are good
\ & Ampersand
(the backslash is
needed for escape)
Optional args
to a function
(defn name-summary [name1 & others]
   (println name1 " and " (count others) " more"))
* Asterisk earmuffs:
used for fields that may be rebound
I think this is a convention and not actually
defined by the language
(def *some-var* (some-func xx))

You’re welcome.