Reputation: 9061
'()
is a syntax sugar for (quote ())
. But what does '[]
mean? Quote a vector?
For example:
(use '[clojure.test :as t])
(.get '[a b c] 1)
(.containsAll '[a b c] '[b c])
((fnth 5) '[a b c d e])
Upvotes: 3
Views: 115
Reputation: 51500
Precisely. '
is a synonym for quote
, so
'[a b c]
is just
(quote [a b c])
quote
prevents evaluation of a Clojure code, so quoting the whole vector is essentially the same as quoting every single element of it:
['a 'b 'c]
It allows you to produce a vector of symbols, without explicitly calling symbol
function:
[(symbol "a") (symbol "b") (symbol "c")]
Upvotes: 13