macro | since v0.0-2985 | clojure.core/import | Edit |
(import & import-symbols-or-lists)
import-list => (closure-namespace constructor-name-symbols*)
Only usable from a REPL.
Import Google Closure classes.
(import 'goog.math.Long
'[goog.math Vec2 Vec3]
'[goog.math Integer])
(Long. 4 6)
;;=> #<25769803780>
(Vec2. 1 2)
;;=> #<(1, 2)>
(Vec3. 1 2 3)
;;=> #<(1, 2, 3)>
(Integer.fromString "10")
;;=> #<10>
import-list => (closure-namespace constructor-name-symbols*) For each name in constructor-name-symbols, adds a mapping from name to the constructor named by closure-namespace to the current namespace. Use :import in the ns macro in preference to calling this directly.
(core/defmacro import
[& import-symbols-or-lists]
`(~'ns* ~(cons :import import-symbols-or-lists)))