Organizing with Namespaces
Clojure code is compiled and evaluated as a series of individual top-level forms (functions, records, protocols, and so on), but Clojure provides namespaces to group those individual forms. Namespaces are named, hierarchical containers that we can use to collect, organize, and name groups of forms. One practical use of namespaces is to allow us to use simple names in our code without worrying that we’ll conflict with the same name somewhere else. The namespace provides a means of specifying which one we mean.
Although Clojure code is made up of finer-grained elements, dependencies are declared and loaded at the namespace level, not at the function level. The ns macro in each namespace defines its dependencies, collectively ...
Get Clojure Applied 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.