On Apr 8, 2009, at 8:13 PM, Stuart Halloway wrote:

Changed to as-str (r654).

Very nice!

Should we extend as-str to any number of arguments like its close cousin str?

Here's a proposed implementation:

(defn as-str
"With no args, returns the empty string. With one arg, returns its name
  or string representation. (as-str nil) returns the empty string. With
more than one arg, returns the concatenation of the as-str values of the
  args."
  {:tag String}
  ([] "")
  ([x]
     (if (instance? clojure.lang.Named x)
       (name x)
       (str x)))
  ([x & ys]
     (let [sb (StringBuilder. #^String (as-str x))]
       (doseq [y ys]
         (.append sb (as-str y)))
       (.toString sb))))

Comments welcome.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to