May 2018
Beginner to intermediate
290 pages
6h 43m
English
If you look at real-world code you will discover that Clojure programmers overwhelmingly choose the vector over the list for their sequential-data-structure needs. Thus, finding real-world uses of the vector brings new meaning to the word easy. Vectors are found at the heart of just about every Clojure program. Take, for example, this bit of real-world code:
| | (defn escape-html [string] |
| | (replace-all string [["&" "&"] |
| | ["\"" """] |
| | ["<" "<"] |
| | [">" ">"]])) |
Clearly the preceding function—which I adopted from the Clostache HTML templating library[9]—defines a function called escape-html. Equally clear is that the escape-html function takes a single parameter with the less-than-enlightening name of ...
Read now
Unlock full access