With clojure 1.8, we got many of these functions, but not str/length and str/substring.
What am I missing? /mattias Den fredag 1 november 2013 kl. 19:40:42 UTC+1 skrev Sean Corfield: > > This thread made me run a quick audit of our code and we had about a > dozen calls to .length, a dozen calls to .substring, and a handful of > calls to .replace - of which a few were in truly performance sensitive > code (doing Unicode-related processing across large strings, so they > had lots of other Java interop and type hints, and were deliberately > procedural). Replacing the rest with count, subs, and > clojure.string/replace (renamed to str-replace to avoid > clojure.core/replace) definitely looks "nicer" and runs plenty faster > enough for what we need. > > So thanks to Alice for raising this and spurring me to make our code > more idiomatic :) > > Sean > > On Fri, Nov 1, 2013 at 9:38 AM, <vra...@gmail.com <javascript:>> wrote: > > > > > > On Thursday, October 31, 2013 10:37:33 PM UTC-5, Mikera wrote: > >> > >> OTOH, count is much more generic since it can handle arbitrary > sequences > >> etc. Also count doesn't require type hints. You should definitely > prefer > >> count when writing most high level code. > > > > > > Yes, I'd prefer count in higher level code over .length for easier > Clojure / > > ClojureScript code sharing. > > > > For what it's worth, src/clj/clojure/string.clj uses `.length` > throughout > > (except the capitalize function for I don't know why). > > > > -- > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com > <javascript:> > > Note that posts from new members are moderated - please be patient with > your > > first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google > Groups > > "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to clojure+u...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > World Singles, LLC. -- http://worldsingles.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.