1.2.0 permalink Arrow_down_16x16

symbol-name-parts

swank.util.clojure

  • (symbol-name-parts symbol)
  • (symbol-name-parts symbol default-ns)
Parses a symbol name into a namespace and a name. If name doesn't
contain a namespace, the default-ns is used (nil if none provided).

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source swank/util/clojure.clj:20 top

(defn symbol-name-parts
  "Parses a symbol name into a namespace and a name. If name doesn't
   contain a namespace, the default-ns is used (nil if none provided)."
  ([symbol]
     (symbol-name-parts symbol nil))
  ([#^String symbol default-ns]
     (let [ns-pos (.indexOf symbol (int \/))]
       (if (= ns-pos -1) ;; namespace found? 
         [default-ns symbol] 
         [(.substring symbol 0 ns-pos) (.substring symbol (inc ns-pos))]))))
Vars in swank.util.clojure/symbol-name-parts: = defn let symbol
Used in 0 other vars

Comments top

No comments for symbol-name-parts. Log in to add a comment.