Created
August 16, 2025 11:52
-
-
Save niw/31623f57efbbe2f357f6fee47362fab0 to your computer and use it in GitHub Desktop.
Revisions
-
niw created this gist
Aug 16, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // // Tuple.swift // Tuple // // Created by Yoshimasa Niwa on 8/8/25. // public struct Tuple<each T: Equatable>: Equatable { public static func == (lhs: Tuple<repeat each T>, rhs: Tuple<repeat each T>) -> Bool { var result = true func compare<U: Equatable>(lhs: U, rhs: U) { if !result { return } result = lhs == rhs } repeat compare(lhs: each lhs.values, rhs: each rhs.values) return result } public var values: (repeat each T) public init(_ values: repeat each T) { self.values = (repeat each values) } }