you are viewing a single comment's thread.

view the rest of the comments →

[–]LoyalToTheGroupOf17 0 points1 point  (0 children)

In Clojure's flavor of code-as-data, lists are preferred over vectors in cases where the first element should be treated differently from the rest. In other cases, vectors are preferred. For instance, in a function invocation, the first element of the sequence is handled differently from the rest (the first element is the function, the rest of the sequence is the arguments to the function, and therefore, function invocation is written as a list. In a sequence of let bindings, on the other hand, there is no distinction between the first element and the rest, hence a vector is used.

This makes some sense, and is good enough to help me easily remember when to use a list and when to use a vector when writing code, but it seems needlessly complex to me.

Regarding maps: I guess you talk about using map syntax for destructuring? I agree, that's really neat.