On Thu, Dec 23, 2010 at 3:24 AM, Remco van 't Veer <rwvtv...@gmail.com> wrote:
> Simpler and faster:
>
>  (count (clojure.string/replace s " " ""))

Simpler, yes, but not at all faster:

Time (in nanoseconds): 120485.9396

This is about comparable to the slow, unoptimized loop posted at the
start of this thread. Frankly, I'm surprised it's not even worse since
it creates a whole extra string object on top of that.

-- 
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