-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
10 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
|
||
@_spi(Internal) | ||
public func areEqual<each Element: Equatable>(_ lhs: (repeat each Element), _ rhs: (repeat each Element)) -> Bool { | ||
|
||
// https://github.com/apple/swift-evolution/blob/main/proposals/0408-pack-iteration.md | ||
|
||
func isEqual<T: Equatable>(_ left: T, _ right: T) throws { | ||
if left == right { | ||
return | ||
} | ||
|
||
throw NotEqual() | ||
|
||
for (left, right) in repeat (each lhs, each rhs) { | ||
guard left == right else { return false } | ||
} | ||
|
||
do { | ||
repeat try isEqual(each lhs, each rhs) | ||
} catch { | ||
return false | ||
} | ||
|
||
return true | ||
|
||
} | ||
|
This file contains 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