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
prefix operator ╯°□°╯┻━┻ | |
prefix func ╯°□°╯┻━┻ (s: String) -> String { | |
return String(s.characters.reversed()) | |
} | |
print(╯°□°╯┻━┻"hello world") // "dlrow olleh" |
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
/// Wraps a value but causes it to be treated as "value-less" for the purposes | |
/// of automatic Equatable, Hashable, and Codable synthesis. This allows one to | |
/// declare a "cache"-like property in a value type without giving up the rest | |
/// of the benefits of synthesis. | |
public enum Transient<Wrapped>: Equatable, Hashable, Codable { | |
case none | |
case some(Wrapped) | |
public static func == (lhs: Transient<Wrapped>, rhs: Transient<Wrapped>) -> Bool { |
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
/// Returns a Boolean value indicating whether the two arguments are equal according to their | |
/// conformance to `Equatable`. | |
/// | |
/// If `lhs` and `rhs` are the same type and that type conforms to ``Equatable``, then this function | |
/// returns the result of evaluating `==` on those values. Otherwise (if the values are different | |
/// types, or the same type but the type does not conform to `Equatable`), this function returns | |
/// false. | |
func areValuesEqual(_ lhs: Any, _ rhs: Any) -> Bool { | |
func isOpenedValueEqual<LHS>(to openedLHS: LHS) -> Bool { | |
let equatable = ExistentialOperations<LHS>.self as? ExistentialEquatable.Type |