java-utils/as-str could be variadic
Compojure has a function called str* that works like clojure.core/str but uses the names of symbols/keywords instead of their literal representation.
clojure.contrib.java-utils/as-str fulfills the same purpose, but only accepts a single argument.
as-str could be 100% compatible with str if it became variadic:
clojure.contrib.java-utils/as-str fulfills the same purpose, but only accepts a single argument.
as-str could be 100% compatible with str if it became variadic:
(defn as-str
[& args]
(apply str (map (fn [x] (if (instance? clojure.lang.Named x)
(name x) x))
args)))
user> (as-str "Hello, " :World)
"Hello, World"
Leave a comment
on 2009-08-21 16:49 *
By stuartsierra
Assigned to set to stuartsierra
Status changed from New to Accepted
(In revision:5dbecc380cbb65afff33648325f1e3b44b535143) java_utils.clj: made as-str variadic like str, fixes #18
This commit also includes tests for this function.
Branch: master
This commit also includes tests for this function.
Branch: master