Created
September 17, 2019 02:33
-
-
Save bbqbaron/a2f1353eb849dd0893391db9138990f9 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
; this isn't to throw shade at the dev; i just felt java had a lot of incidental complexity and wanted to understand what the code does | |
(defn fragmentize-chunk [chunk] | |
(set (map #(take % chunk) [1 2 3]))) | |
(defn fragmentize-word [word] | |
(->> (range (count word)) | |
(map #(drop % word)) | |
(mapcat fragmentize-chunk) | |
(map clojure.string/join))) | |
(defn fragmentize [words] | |
(->> words | |
(map clojure.string/lower-case) | |
(mapcat fragmentize-word) | |
frequencies)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment