(defn
parse-symbol
"Parses a string into a vector of the namespace and symbol"
[token]
(when-not
(or
(identical? "" token)
(true? (.test #":$" token))
(true? (.test #"^::" token)))
(let
[ns-idx
(.indexOf token "/")
ns
(when (pos? ns-idx) (subs token 0 ns-idx))]
(if-not
(nil? ns)
(let
[ns-idx (inc ns-idx)]
(when-not
(== ns-idx (count token))
(let
[sym (subs token ns-idx)]
(when
(and
(not (numeric? (nth sym 0)))
(not (identical? "" sym))
(false? (.test #":$" ns))
(or (identical? sym "/") (== -1 (.indexOf sym "/"))))
[ns sym]))))
(when
(or (identical? token "/") (== -1 (.indexOf token "/")))
[nil token])))))