;; Awesome. Implementation of a word trie in clojure. (use '[clojure.string :only (split-lines)]) (def words (map seq (split-lines (slurp "words.txt")))) (defn add-to-trie [trie x] (assoc-in trie x {:terminal true})) (defn in-trie? [trie x] (get-in trie `(~@x :terminal))) (def trie (reduce add-to-trie {} words)) (defn word-in-trie? [w] (in-trie? trie (seq w)))