mega-insert for trie!

This commit is contained in:
Tommi Reiman 2019-01-29 16:50:44 +02:00
parent 8628f0cec6
commit 4c0d2fb285

View file

@ -89,8 +89,16 @@
(update :children dissoc "")) (update :children dissoc ""))
node'))) node')))
(defn insert [node path data] (defn insert
(-insert (or node (-node {})) (-split path) data)) ([routes]
(insert nil routes))
([node routes]
(reduce
(fn [acc [p d]]
(insert acc p d))
node routes))
([node path data]
(-insert (or node (-node {})) (-split path) data)))
(defn ^Trie$Matcher compile [{:keys [data children wilds catch-all]}] (defn ^Trie$Matcher compile [{:keys [data children wilds catch-all]}]
(let [matchers (cond-> [] (let [matchers (cond-> []