user=> (defn word-enrichment "input: a string 'a b b' output: a map : {'a' 1 'b' 2}" [str_in] {:pre [(= (type str_in) (type ""))]} (let [all (clojure.string/split str_in #"\b+")] (reduce #(let [v (%1 %2)] (assoc %1 %2 (if v (inc v) 1) )) {} all)))