One thing I like about Clojure is there are not as many punctuation characters in the code, like there are in Perl or Scala. This makes it easier to read. But there are some.
Much of this info is also on the Clojure site called “Reading Clojure Characters“.
[table border=”1”]
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))~~@some-data
(,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})
::, Double Colon, Keyword in the current namespace
#(, Pound sign ~~and parentheses, 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”))
^,caret,Metadata~~Can be used for function arg types,[x ^java.io.Writer w]
*,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))
[/table]
You’re welcome.