Created
March 3, 2017 23:11
-
-
Save hlolli/95adb1dc124acc10e61cc30263234024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns panaeolus.macros | |
(:require [lumo.repl :refer [get-current-ns]])) | |
(ns panaeolus.macros$macros) | |
(defmacro pull-symbols [from-namespace] | |
`(let [into-namespace# (symbol (lumo.repl/get-current-ns)) | |
into-map# (or (get-in @env/*compiler* [:cljs.analyzer/namespaces | |
into-namespace# | |
:uses]) {}) | |
new-symbols# (keys (get-in @env/*compiler* | |
[:cljs.analyzer/namespaces ~from-namespace :defs])) | |
merged-map# (reduce #(assoc %1 %2 ~from-namespace) into-map# new-symbols#)] | |
(prn into-namespace#) | |
(swap! env/*compiler* assoc-in [:cljs.analyzer/namespaces | |
into-namespace# | |
:uses] merged-map#) | |
nil)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment