Created
June 14, 2022 19:04
-
-
Save drcode/8e656fe07a7ef2280dae99eedc80d573 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
;;THE MOST: 42% of words with J in them start with J | |
;;THE LEAST: 1.6% of words with Y in them start with Y | |
;; Word list used: https://github.com/dwyl/english-words | |
;; Calculation in clojure as follows: | |
(def words (st/split (slurp "words.txt") #"\n")) | |
(println (sort-by :percentage-starts | |
(for [c (map char (map (partial + (int \a)) (range 26)))] | |
(let [contains (count (filter (partial some #{c}) | |
words)) | |
starts (count (filter (fn [word] | |
(= (first word) c)) | |
words))] | |
{:char c | |
:percentage-starts (float (* 100 (/ starts contains)))})))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment