You Got Data On My Code!
If you have read this far you probably noticed something odd about the syntax of Clojure code: it looks a lot like the syntax of Clojure data literals. If, for example, you started with this bit of nonsensical Clojure data:
| ;; Just some data: Note the quote. |
| |
| '(helvetica times-roman [comic-sans] |
| (futura gil-sans |
| (courier "All the fonts I have loved!"))) |
you know you have a four-element list that contains a couple of symbols along with a vector and another list. But by swapping out the symbols and changing contents of the string, you can transform that data into something convincingly codelike:
| ;; Still just data -- note the quote. |
| |
| '(defn print-greeting [preferred-customer] |
| (if |
Get Getting Clojure now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.