clojure-russia

Работа и релокейт: #jobs-rus | #clojure-russia-offtop Телеграм-чат https://t.me/clojure_ru
dottedmag 2018-08-01T20:00:09.000329Z

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

(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)))))

dottedmag 2018-08-01T20:00:27.000357Z

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

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