Created
September 26, 2019 03:06
-
-
Save galdolber/5f4f30bd663c1dfcfbe1b3165a45354d to your computer and use it in GitHub Desktop.
freqs
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
(defn freqs-inner [coll m] | |
(if (empty? coll) | |
m | |
(freqs-inner (rest coll) | |
(assoc m (first coll) | |
(+ 1 (or (get m (first coll)) 0)))))) | |
(defn freqs [coll] | |
(freqs-inner coll {})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment