Skip to content

Instantly share code, notes, and snippets.

@hlolli
Created March 3, 2017 23:11
Show Gist options
  • Save hlolli/95adb1dc124acc10e61cc30263234024 to your computer and use it in GitHub Desktop.
Save hlolli/95adb1dc124acc10e61cc30263234024 to your computer and use it in GitHub Desktop.
(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