3 ms·
Vectors eval to themselves, while lists eval to a function/macro/special-form call. Vectors also differ from lists in that they are ordered and indexed, so in
by weavejester 10y ago
Vectors eval to themselves, while lists eval to a function/macro/special-form call.
Vectors also differ from lists in that they are ordered and indexed, so in macros and special forms they tend to be used to represent positional bindings.
- junke 10y agoThis has nothing to do with performance. Also, there is no such clear distinction in how vectors and lists are used. You still require context to know if a vector is evaluated to itself or not, or if a list is a call. Without context, you can't say looking at [x y] which of x or/and y is being evaluated: (let [a [x y]] ...) (let [x y] ...) (fn [x y] ...) As for parenthesis, you have special cases too: (defn foo ([] (foo 0)) ([n] ...)) And sometimes, people aren't sure about what to use: https://github.com/bbatsov/clojure-style-guide/issues/64 https://github.com/bbatsov/clojure-style-guide/issues/64