OR
Size: a a a
Д
T
T
IL
T
IL
T
IL
(time
(dotimes [i 100000]
(let [input "cat cat cat ! bar cat cat ! cat ! ! cat cat cat cat cat cat ! cat"
search "cat cat"
iter (take-while
(comp (partial <= (count search)) count)
(iterate rest input))]
(->> iter
(map (partial take (count search)))
(filter (partial = (seq search)))
(map str/join)
doall))))
"Elapsed time: 4988.35768 msecs"
=> nil
(time
(dotimes [i 100000]
(doall
(map #(->> % rest (string/join " "))
(re-seq #"(cat) (?=(cat))" "cat cat cat ! bar cat cat ! cat ! ! cat cat cat cat cat cat ! cat")))
))
"Elapsed time: 591.221235 msecs"
OR
user=> (time (dotimes [i 100000] (reduce (fn [acc i] (when-let [pos (clojure.string/index-of "cat cat cat" "cat cat" i)] (conj acc pos))) #{} (range (- (count "cat cat cat") (count "cat cat"))))))
"Elapsed time: 149.210892 msecs"
user=> (time (dotimes [i 100000] (reduce (fn [acc i] (when-let [pos (clojure.string/index-of "cat cat cat" "cat cat" i)] (conj acc pos))) #{} (range (- (count "cat cat cat") (count "cat cat"))))))
"Elapsed time: 62.439154 msecs"
IL
DF
reduce-kv
(reduce-kv conj [] (subvec [:a :b :c :d] 1 3) )
No implementation of method
OR
OR
No implementation of method: :kv-reduce of protocol: #'clojure.core.protocols/IKVReduce found for class: clojure.lang.APersistentVector$SubVector
OR
T