Created
June 7, 2016 00:44
-
-
Save seb231/311fa7afe8f45216d89b2f01772e0a6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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