Skip to content

Instantly share code, notes, and snippets.

@galdolber
Created September 26, 2019 03:06
Show Gist options
  • Select an option

  • Save galdolber/5f4f30bd663c1dfcfbe1b3165a45354d to your computer and use it in GitHub Desktop.

Select an option

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