On Thu, Jul 1, 2010 at 6:06 PM, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> 2010/7/1 Martin DeMello <martindeme...@gmail.com>:
>> 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 ?

I haven't benchmarked yet, but it's called frequently enough that it's
probably worth making it efficient. (This is in code that converts a
dictionary to a trie)

martin

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to