This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-25
Channels
- # architecture (4)
- # bangalore-clj (3)
- # beginners (11)
- # chestnut (1)
- # cider (24)
- # cljs-dev (14)
- # clojure (97)
- # clojure-finland (1)
- # clojure-gamedev (19)
- # clojure-italy (11)
- # clojure-nl (31)
- # clojure-norway (1)
- # clojure-uk (52)
- # clojurescript (71)
- # core-async (4)
- # cursive (60)
- # datascript (8)
- # datomic (115)
- # emacs (29)
- # figwheel (11)
- # fulcro (3)
- # garden (1)
- # hoplon (1)
- # lein-figwheel (1)
- # leiningen (7)
- # luminus (13)
- # mount (1)
- # off-topic (51)
- # onyx (31)
- # pedestal (2)
- # portkey (1)
- # re-frame (22)
- # reagent (22)
- # reitit (6)
- # remote-jobs (1)
- # schema (1)
- # shadow-cljs (73)
- # specter (2)
- # sql (1)
- # unrepl (3)
- # vim (11)
- # yada (4)
I'm looking for a way to do something almost like partition-by. I have a very long string, and a long vector of {:start start1 :end end1}
denoting substrings in the string. The vector is already sorted by position, and the substrings are guaranteed not to overlap. I need to collect a sequence of all these substrings, and another sequence of the intervening substrings. (That is, (f "0123456789" [{:start 0 :end 2} {:start 5 :end 8}]) ==> {:in ["01" "567"] :out ["" "234" "89"]}
). The string is long enough that I may need to care about efficiency.
or reduce over the big string taking up to the next indicator. just mash all of the start finishes into a list and reduce over those markers.
@dpsutton Thanks. Guess I'll try that and see if it is fast enough. I was afraid that the repeated subs over the entire big string would be quadratically painful. But, I should probably avoid premature optimization for now.
and if it is, just traverse once with the reduction, taking up to the next marker and alternating which collection it goes into
reduce tracking both the collection of substrings and the last end index is likely the best mix of simple / performant. subs is cheap, much cheaper than treating the string as a seq
I have a cljc
file in lein project and I have cljc
test for it in the test folder
Now I want to include cljc test in both clj and cljs test runners and see the results of the tests
to include and run cljc test in clj test runner, I have to compile it and :aot :all
doesn’t seem to work in the test folder
usually you don’t need to aot test files, but perhaps you have a gen-class or something that does require it. I’m not sure how to cause that to happen but #leiningen would perhaps be the best place to ask