Namespaces and Libraries

  • Luke VanderHart
  • Stuart Sierra


Namespaces are the means by which you divide your Clojure code into logical groups, similar to packages in Java or modules in other languages. Almost every Clojure source file begins with a namespace declaration using the ns macro. The following code is an example of a namespace declaration:
$$ \begin{gathered} \left( {ns clojure.contrib.gen - html - docs} \right. \hfill \\ \left( {:require\left[ { - streams :as duck - streams} \right]} \right) \hfill \\ \left( {:use \left( {clojure.contrib seq - utils str - utils repl - utils def prxml} \right)} \right) \hfill \\ \left( {:import \left( {java.lang Exception} \right)} \right. \hfill \\ \left. { \left. { \left( {java.util.regex Pattern} \right)} \right)} \right) \hfill \\ \end{gathered} $$


Return Mapping Source File Java Class Load Function Java Package 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Luke VanderHart and Stuart Sierra 2010

Authors and Affiliations

  • Luke VanderHart
  • Stuart Sierra

There are no affiliations available

Personalised recommendations