Skip to content

Instantly share code, notes, and snippets.

@nixin72
Created September 26, 2020 04:06
Show Gist options
  • Save nixin72/488cf64969ef7f41f66b79c43ee70e7d to your computer and use it in GitHub Desktop.
Save nixin72/488cf64969ef7f41f66b79c43ee70e7d to your computer and use it in GitHub Desktop.
; Challenge from a friend:
;
; - Read a file of text
; - determine the n most frequently used words
; - print out a sorted list of those words along with their frequencies)
(-> filename
(slurp)
(lower-case)
(clojure.string/replace #"\d" "")
(clojure.string/split #" ")
(frequencies)
(#(sort-by second > %)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment