Pair
structure Pair<T, U> {
first: T
second: U
}
An ordered pair of two values, possibly of different types.
first
Pair.first: Pair<T, U> -> T
The first element of the pair.
second
Pair.second: Pair<T, U> -> U
The second element of the pair.
swap
define swap(self) -> Pair<U, T> {
Pair.new(self.second, self.first)
}
Swaps the first and second elements of the pair.