Err. @misha ((frequencies "\n\n") "\n") => 2 But I didn't expect the behavior of split lines. I would have expected a blank string for each new line
yeah, frequencies seems to be 10x faster than count re-seq, but regex is actually #"\n\r|\r\n|\n|\r" or something like this.
all those shenanigans are exactly because empty strings are omitted from "default" tools you'd reach for :(
* 10x faster on that little useless string that is. on an actual text (any source code file) - it is ∞ slower (imagine frequencies clojure.core.clj just to count lines :))
If the source is big enough use the reducer library/ns.
If it's bigger then that then you use onyx
On the backend/clojure of course.
https://www.reddit.com/r/mit6824clojure/comments/hhma5e/none_distributed_but_multithread_map_reduce_in/?utm_medium=android_app&utm_source=share Here's a post about word count i wrote
~20k lines, worst case scenario – need to run it within 16msec to maintain 60fps :opieop: on client, hence writing in #clojurescript channel
(ofc. for such use case, there will be more involved datastructures and supporting state, so lines count will be custom fn, etc. the point of the PSA - str/split-lines ignores empty lines.)