May 2018
Beginner to intermediate
290 pages
6h 43m
English
The downside of using fully qualified names like blottsbooks.pricing/discount-price is that they can get long, and long names tend to clutter up your code and make it less readable. Fortunately, Clojure provides a couple of shortcuts to minimize the clutter.
One way you can make your code less noisy is to create an alias for the namespace, like this:
| | (require '[blottsbooks.pricing :as pricing]) |
or like this:
| | (ns blottsbooks.core |
| | (:require [blottsbooks.pricing :as pricing]) |
| | (:gen-class)) |
Note that we’re now feeding require a three-element vector instead of just the name of the namespace. As shown in the figure, the extended version of require not only pulls in the blottsbooks.pricing namespace but also gives it an alias of ...
Read now
Unlock full access