2010/7/1 Martin DeMello <[email protected]>:
> Anything more efficient than (map str (seq string)) ?
I cannot think of another hof-like version that may be more efficient.
If you want to avoid at all cost the creation of intermediate Seq elements:
(defn explode-string [^String string]
(loop [i (int 0) v (transient [])]
(if (== i (.length string))
(persistent! v)
(recur (inc i) (conj! v (.substring string i (inc i)))))))
But do you really need a so much more complex version ?
(and also note that this version fully realizes the exploded string,
which may or may not be what you're after)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en