-
-
Save tommyettinger/1aa331ebf9beae79fb6f to your computer and use it in GitHub Desktop.
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 diff [l1 l2] | |
(let [a (group-by identity l1) | |
b (group-by identity l2)] | |
(mapcat #(repeat | |
(- | |
(count (second %)) | |
(count (get b (key %)))) | |
(key %)) | |
a))) | |
(defn diff-unordered [l1 l2] | |
(let [a (group-by identity l1) | |
b (group-by identity l2)] | |
(mapcat #(repeat | |
(Math/abs (- | |
(count (second %)) | |
(count (get b (key %))))) | |
(key %)) | |
a))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment