Lists
Clojure has a second data type that—at least at first blush—seems a lot like the vector: the list. Like a vector, a list is an ordered collection of items. To make a list, you surround your items with round parentheses instead of the square brackets you would use for a vector:
| | '(1 2 3) |
If you look closely at the list in that code example, you will see a second syntactic twist: the list is preceded by a single-quote character. We need that quote for a very prosaic reason: lists, with their round parentheses, look just like Clojure code. Syntactically it’s hard to tell the difference between (1 2 3) and (def x 99). The quote’s job is to stand there in front of the list and shout, Hey! The thing that comes next is data. Don’t try to execute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access