Created
October 21, 2016 04:01
-
-
Save metric-space/6e6ba4dfd2f5ed2f7c0d596b3d9cc1f0 to your computer and use it in GitHub Desktop.
hamming distance in clojure
This file contains hidden or 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 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