Professional Documents
Culture Documents
Ranges
Ranges
упорядоченные множества
is
последовательных значений
property hashValue Hashable can be endless or not
== Equatable classification
1..<N (1=1, N=N-1)
all the ranges are not comparable as we can't binary (operator between operands)
Comparable
compare them with <, >, <=, >=.
type Range<Type> Type should be Comparable
half-open range ..< two forms
..<N (first element is nil, N=N-1)
prefix/ one-sided range (operator before
count
operand)
type PartialRangeUpTo<Type> Type should be Comparable
isEmpty
2 types of operators 1...N (1=1, N=N)
value of the first element binary(closed range operator)
propeties
only for Int
lowerBound
Ranges type ClosedRange<Type> Type should be Comparable
minimal value
min() empty range let emptyR = 0..<0
only for Int
methods
range with one element let notEmptyR = 0...0
maximum value
max() PartialRangeThrough<Type>
!!! not Sequence and not Collection ->
only for Int
Strideable
PartialRangeUpTo<Type>