Last active
August 29, 2015 14:24
-
-
Save oisdk/e50c984680839af7dfbd to your computer and use it in GitHub Desktop.
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
postfix operator < {} | |
postfix operator <= {} | |
prefix operator > {} | |
prefix operator >= {} | |
postfix func < <C : Comparable>(lhs: C)(_ rhs: C) -> Bool { | |
return lhs < rhs | |
} | |
postfix func <= <C : Comparable>(lhs: C)(_ rhs: C) -> Bool { | |
return lhs <= rhs | |
} | |
prefix func > <C : Comparable>(lhs: C)(_ rhs: C) -> Bool { | |
return rhs > lhs | |
} | |
prefix func >= <C : Comparable>(lhs: C)(_ rhs: C) -> Bool { | |
return rhs >= lhs | |
} | |
[1, 2, 3, 4, 5].filter(4<) // [5] | |
prefix operator ~= {} | |
postfix operator ~= {} | |
prefix func ~=<T>(lhs: _OptionalNilComparisonType)(_ rhs: T?) -> Bool { | |
return lhs ~= rhs | |
} | |
prefix func ~=<T : Equatable>(a: T)( _ b: T) -> Bool { | |
return a ~= b | |
} | |
prefix func ~=<I : ForwardIndexType where I : Comparable>(pattern: Range<I>)(_ value: I) -> Bool { | |
return pattern ~= value | |
} | |
prefix func ~=<I : IntervalType>(pattern: I)(_ value: I.Bound) -> Bool { | |
return pattern ~= value | |
} | |
postfix func ~=<T>(lhs: _OptionalNilComparisonType)(_ rhs: T?) -> Bool { | |
return lhs ~= rhs | |
} | |
postfix func ~=<T : Equatable>(a: T)( _ b: T) -> Bool { | |
return a ~= b | |
} | |
postfix func ~=<I : ForwardIndexType where I : Comparable>(pattern: Range<I>)(_ value: I) -> Bool { | |
return pattern ~= value | |
} | |
postfix func ~=<I : IntervalType>(pattern: I)(_ value: I.Bound) -> Bool { | |
return pattern ~= value | |
} | |
prefix operator == {} | |
postfix operator == {} | |
prefix func == <E : Equatable>(lhs: E)(_ rhs: E) -> Bool { | |
return lhs == rhs | |
} | |
postfix func == <E : Equatable>(lhs: E)(_ rhs: E) -> Bool { | |
return lhs == rhs | |
} | |
(0..<100).filter((5..<15)~=) // [5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
(0..<10 ).filter(==5) // [5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment