Skip to content

Instantly share code, notes, and snippets.

@metric-space
Created October 21, 2016 04:01
Show Gist options
  • Select an option

  • Save metric-space/6e6ba4dfd2f5ed2f7c0d596b3d9cc1f0 to your computer and use it in GitHub Desktop.

Select an option

Save metric-space/6e6ba4dfd2f5ed2f7c0d596b3d9cc1f0 to your computer and use it in GitHub Desktop.
hamming distance in clojure
(defn hamming-distance [s1 s2]
(if (not= (count s1) (count s2))
(throw (Exception. "Lengths are not equal"))
(->> (map = s1 s2)
(remove true?)
(count))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment