Skip to content

Instantly share code, notes, and snippets.

@seb231
Created June 7, 2016 00:44
Show Gist options
  • Save seb231/311fa7afe8f45216d89b2f01772e0a6b to your computer and use it in GitHub Desktop.
Save seb231/311fa7afe8f45216d89b2f01772e0a6b to your computer and use it in GitHub Desktop.
(def input
[{:sentence "Lorem ipsum dolor sit amet, consectetur adipiscing elit."}
{:sentence "Vestibulum tincidunt leo lectus, ac vulputate quam aliquet a."}
{:sentence "Ut molestie suscipit faucibus."}
{:sentence "Curabitur hendrerit tortor quis sodales consequat."}])
(def splitter
(comp #(map (fn [x] (hash-map :word x)) %)
#(clojure.string/split % #" ")))
(defn split-sentence [{:keys [sentence]}]
(splitter sentence))
(defn other-splitter [{:keys [sentence]}]
(->> (clojure.string/split sentence #" ")
(map (fn [x] (hash-map :word x)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment