(defn ^:dynamic resolve-symbol
"Resolve a symbol s into its fully qualified namespace version"
[s]
(if (pos? (.indexOf (name s) "."))
(if (.endsWith (name s) ".")
(let [csym (symbol (subs (name s) 0 (dec (count (name s)))))]
(symbol (str (name (resolve-symbol csym)) ".")))
s)
(if-let [ns-str (namespace s)]
(let [ns (resolve-ns (symbol ns-str))]
(if (or (nil? ns)
(= (ns-name* ns) ns-str)) ;; not an alias
s
(symbol (ns-name* ns) (name s))))
(if-let [o ((ns-map *ns*) s)]
(if (class? o)
(symbol (.getName ^Class o))
(if (var? o)
(symbol (-> ^Var o .ns ns-name*) (-> ^Var o .sym name))))
(symbol (ns-name* *ns*) (name s))))))