Skip to content

Instantly share code, notes, and snippets.

@uggds
Last active September 6, 2015 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uggds/7bd5ab310ce4eac666ad to your computer and use it in GitHub Desktop.
Save uggds/7bd5ab310ce4eac666ad to your computer and use it in GitHub Desktop.
(defn indexable-word? [word]
(> (count word) 2))
(require '[clojure.string :as str])
(filter indexable-word? (str/split "A fine day it is" #"¥W+"))
-> ("fine" "day")
(filter (fn [w] (> (count w) 2)) (str/split "A fine day is it" #"\W+"))
-> ("fine" "day")
(filter #(> (count %) 2) (str/split "A fine day is it" #"\W+"))
-> ("fine" "day")
(defn indexable-words [text]
(let [indexable-word? (fn [w] (> (count w) 2))]
(filter indexable-word? (str/split text #"¥W+"))))
(indexable-words "A fine day it is")
-> ("fine" "day")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment