(visit trie))))
(defn- trie-put
- ([s]
- {:pre [(string? s)]}
- (trie-put {} s))
+ ([s] (trie-put {} s))
([trie s]
{:pre [(map? trie) (string? s)]}
(if-not (seq s)
- {}
+ trie
(loop [t trie, ps (prefixes s)]
(if-let [cs (and (next ps) (first ps))]
(recur (grow t cs false) (next ps))
(is (not (or (re-matches pat1 "f")
(re-matches pat1 "b")
(re-matches pat1 "ba")
- (re-matches pat1 "fo"))))))
+ (re-matches pat1 "fo")))))
+
+ (let [pat1 (pattern ["foo" "foot"])
+ pat2 (pattern ["foo" "" "foot"])]
+ (is (= (str pat1)
+ (str pat2)))))