Skip to content

Instantly share code, notes, and snippets.

@galdolber
Created September 26, 2019 03:06
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 galdolber/5f4f30bd663c1dfcfbe1b3165a45354d to your computer and use it in GitHub Desktop.
Save galdolber/5f4f30bd663c1dfcfbe1b3165a45354d to your computer and use it in GitHub Desktop.
freqs
(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