(import & import-symbols-or-lists)
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.
Spec
(clojure.spec.alpha/fspec
:args
:clojure.core.specs.alpha/quotable-import-list
:ret
clojure.core/any?
:fn
nil)
Source
(defmacro 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."
{:added "1.0"}
[& import-symbols-or-lists]
(let [specs (map #(if (and (seq? %) (= 'quote (first %))) (second %) %)
import-symbols-or-lists)]
`(do ~@(map #(list 'clojure.core/import* %)
(reduce1 (fn [v spec]
(if (symbol? spec)
(conj v (name spec))
(let [p (first spec) cs (rest spec)]
(into1 v (map #(str p "." %) cs)))))
[] specs)))))