Fork me on GitHub
#clojure-russia
<
2018-08-01
>
dottedmag20:08:09

Господа, а вот это никак не улучшить?

(defn re-seq-loc [re s]
  "Similar to re-seq, but every match is a map with keys :start/:end/:match"
  (let [m (re-matcher re s)]
    (take-while
     some?
     (repeatedly #(find-match-loc m)))))

dottedmag20:08:27

find-match-loc тривиальный:

(defn ^:private find-match-loc [m]
  (when (.find m)
    {:start (.start m)
     :end (.end m)
     :match (re-groups m)}))