Skip to content

Instantly share code, notes, and snippets.

@4mitch
Last active December 7, 2018 23:47
Show Gist options
  • Select an option

  • Save 4mitch/2c721fea47ead6d567df1f55b1f39523 to your computer and use it in GitHub Desktop.

Select an option

Save 4mitch/2c721fea47ead6d567df1f55b1f39523 to your computer and use it in GitHub Desktop.
[Clojure] Compare two vectors without order
(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