Created
August 19, 2018 02:02
-
-
Save giginet/eb6eb4958d6c69f4d49ac6c5d4b9eabf 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
private func consistsOfSameElements<Element: Equatable>(between lhs: [Element], and rhs: [Element]) -> Bool { | |
let contained = lhs.compactMap { element in | |
return rhs.contains(element) ? element : nil | |
} | |
return contained == lhs | |
} | |
private func contains<Element: Equatable>(_ element: [Element], in collection: [[Element]]) -> Bool { | |
return collection.contains { consistsOfSameElements(between: element, and: $0) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment