clojure.core/import¶
import-list => (package-symbol class-name-symbols*)
For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly.
Examples¶
Note by gstamp¶
Good description of use/require/import here:
http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns
Note by TimMc¶
import will also accept vectors instead of lists, but I would discourage folks from doing so:
- It's undocumented.
- Lists and vectors have different meanings for
require, so there's precedent for making a distinction. - Lists have a distinguished first element, and so they indent more meaningfully here. :-P
Note by YizhePKU¶
You don't need to use import if you fully qualify the class name, e.g. (java.util.Date.).
See also¶
- clojure.core/require (4)
- clojure.core/use (1)
- clojure.core/ns (3)
Content from the matching ClojureDocs page, with authors credited on each contribution.