symbol
(symbol name)
(symbol ns name)
Source docstring:
Returns a Symbol with the given namespace and name. Arity-1 works
on strings, keywords, and vars.
(defn symbol
([name]
(cond (symbol? name) name
(string? name) (let [idx (.indexOf name "/")]
(if (< idx 1)
(symbol nil name)
(symbol (.substring name 0 idx)
(.substring name (inc idx) (. name -length)))))
(var? name) (.-sym name)
(keyword? name) (recur (.-fqn name))
:else (throw (new js/Error "no conversion to symbol"))))
([ns name]
(let [sym-str (if-not (nil? ns)
(str ns "/" name)
name)]
(Symbol. ns name sym-str nil nil))))