Last active
December 7, 2018 23:47
-
-
Save 4mitch/2c721fea47ead6d567df1f55b1f39523 to your computer and use it in GitHub Desktop.
[Clojure] Compare two vectors without order
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
| (let [a [1 1 2 3 4] | |
| b [1 2 3 4 1]] | |
| (and | |
| #_(time | |
| (and | |
| (.containsAll a b) | |
| (.containsAll b a))) | |
| (time | |
| (= (frequencies a) | |
| (frequencies b)) | |
| ) | |
| (time | |
| (= (sort a) | |
| (sort b)) | |
| ) | |
| ) | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment