0001    // IntervalTypes
0002    
0003    public protocol OpenIntervalType
Slicing.swift:7
public protocol OpenEndedIntervalType: OpenIntervalType {
Slicing.swift:11
public protocol OpenStartedIntervalTypeTo: OpenIntervalType {
Slicing.swift:15
public protocol OpenStartedIntervalTypeThrough: OpenIntervalType {
Slicing.swift:101
public func ~=<I: OpenIntervalType>(lhs: I, rhs: I.Value) -> Bool {
{ 0004 typealias Value
Slicing.swift:5
  func contains(v: Value) -> Bool
Slicing.swift:101
public func ~=<I: OpenIntervalType>(lhs: I, rhs: I.Value) -> Bool {
0005 func contains
Slicing.swift:102
  return lhs.contains(rhs)
(v: Value) -> Bool 0006 } 0007 public protocol OpenEndedIntervalType
Slicing.swift:22
public struct OpenEndedInterval<C: Comparable>: OpenEndedIntervalType {
Slicing.swift:34
public struct OpenEndedRange<I: ForwardIndexType where I: Comparable>: OpenEndedIntervalType {
Slicing.swift:89
extension OpenEndedIntervalType {
: OpenIntervalType { 0008 typealias Value
Slicing.swift:9
  var val: Value { get }
Slicing.swift:90
  public func contains(v: Value) -> Bool { return val <= v }
: Comparable 0009 var val
Slicing.swift:90
  public func contains(v: Value) -> Bool { return val <= v }
: Value { get } 0010 } 0011 public protocol OpenStartedIntervalTypeTo
Slicing.swift:25
public struct OpenStartedIntervalTo<C: Comparable>: OpenStartedIntervalTypeTo {
Slicing.swift:37
public struct OpenStartedRangeTo<I: BidirectionalIndexType where I: Comparable>: OpenStartedIntervalTypeTo {
Slicing.swift:92
extension OpenStartedIntervalTypeTo {
: OpenIntervalType { 0012 typealias Value
Slicing.swift:13
  var val: Value { get }
Slicing.swift:93
  public func contains(v: Value) -> Bool { return val > v }
: Comparable 0013 var val
Slicing.swift:93
  public func contains(v: Value) -> Bool { return val > v }
: Value { get } 0014 } 0015 public protocol OpenStartedIntervalTypeThrough
Slicing.swift:28
public struct OpenStartedIntervalThrough<C: Comparable>: OpenStartedIntervalTypeThrough {
Slicing.swift:40
public struct OpenStartedRangeThrough<I: BidirectionalIndexType where I: Comparable>: OpenStartedIntervalTypeThrough {
Slicing.swift:95
extension OpenStartedIntervalTypeThrough {
: OpenIntervalType { 0016 typealias Value
Slicing.swift:17
  var val: Value { get }
Slicing.swift:96
  public func contains(v: Value) -> Bool { return val >= v }
: Comparable 0017 var val
Slicing.swift:96
  public func contains(v: Value) -> Bool { return val >= v }
: Value { get } 0018 } 0019 0020 // Interval Structs 0021 0022 public struct OpenEndedInterval
Slicing.swift:68
public postfix func ...<C: Comparable>(c: C) -> OpenEndedInterval<C> {
Slicing.swift:69
  return OpenEndedInterval(val: c)
<C
Slicing.swift:23
  public let val: C
: Comparable>: OpenEndedIntervalType { 0023 public let val: C 0024 } 0025 public struct OpenStartedIntervalTo
Slicing.swift:74
public prefix func ..<<C: Comparable>(c: C) -> OpenStartedIntervalTo<C> {
Slicing.swift:75
  return OpenStartedIntervalTo(val: c)
<C
Slicing.swift:26
  public let val: C
: Comparable>: OpenStartedIntervalTypeTo { 0026 public let val: C 0027 } 0028 public struct OpenStartedIntervalThrough
Slicing.swift:80
public prefix func ... <C: Comparable>(c: C) -> OpenStartedIntervalThrough<C> {
Slicing.swift:81
  return OpenStartedIntervalThrough(val: c)
<C
Slicing.swift:29
  public let val: C
: Comparable>: OpenStartedIntervalTypeThrough { 0029 public let val: C 0030 } 0031 0032 // Range structs 0033 0034 public struct OpenEndedRange
Slicing.swift:56
extension OpenEndedRange: SequenceType {
Slicing.swift:71
public postfix func ...<I: ForwardIndexType>(c: I) -> OpenEndedRange<I> {
Slicing.swift:72
  return OpenEndedRange(val: c)
<I
Slicing.swift:35
  public var val: I
: ForwardIndexType where I: Comparable>: OpenEndedIntervalType { 0035 public var val
Hopping.swift:70
    return suffixFrom(r.val)[by: by]
Slicing.swift:58
    return EndlessIncrement(i: val)
Slicing.swift:109
    return suffixFrom(r.val)
Slicing.swift:124
    get { return suffixFrom(r.val) }
Slicing.swift:125
    set { self[r.val..<endIndex] = newValue }
: I 0036 } 0037 public struct OpenStartedRangeTo
Slicing.swift:77
public prefix func ..<<C: BidirectionalIndexType>(c: C) -> OpenStartedRangeTo<C> {
Slicing.swift:78
  return OpenStartedRangeTo(val: c)
<I
Slicing.swift:38
  public var val: I
: BidirectionalIndexType where I: Comparable>: OpenStartedIntervalTypeTo { 0038 public var val
Hopping.swift:73
    return prefixUpTo(r.val)[by: by]
Slicing.swift:115
    return prefixUpTo(r.val)
Slicing.swift:131
    get { return prefixUpTo(r.val) }
Slicing.swift:132
    set { self[startIndex..<r.val] = newValue }
: I 0039 } 0040 public struct OpenStartedRangeThrough
Slicing.swift:83
public prefix func ... <C: BidirectionalIndexType>(c: C) -> OpenStartedRangeThrough<C> {
Slicing.swift:84
  return OpenStartedRangeThrough(val: c)
<I
Slicing.swift:41
  public var val: I
: BidirectionalIndexType where I: Comparable>: OpenStartedIntervalTypeThrough { 0041 public var val
Hopping.swift:76
    return prefixThrough(r.val)[by: by]
Slicing.swift:118
    return prefixThrough(r.val)
Slicing.swift:135
    get { return prefixThrough(r.val) }
Slicing.swift:136
    set { self[startIndex...r.val] = newValue }
: I 0042 } 0043 0044 // Generators 0045 0046 public struct EndlessIncrement
Slicing.swift:57
  public func generate() -> EndlessIncrement<I> {
Slicing.swift:58
    return EndlessIncrement(i: val)
<I
Slicing.swift:47
  private var i: I
Slicing.swift:48
  public mutating func next() -> I? {
: ForwardIndexType>: GeneratorType { 0047 private var i
Slicing.swift:49
    defer { i = i.successor() }
Slicing.swift:49
    defer { i = i.successor() }
Slicing.swift:50
    return i
: I 0048 public mutating func next() -> I? { 0049 defer { i = i.successor() } 0050 return i 0051 } 0052 } 0053 0054 // SequenceType 0055 0056 extension OpenEndedRange: SequenceType { 0057 public func generate() -> EndlessIncrement<I> { 0058 return EndlessIncrement(i: val) 0059 } 0060 } 0061 0062 // Operators 0063 0064 postfix operator ... {} 0065 prefix operator ... {} 0066 prefix operator ..< {} 0067 0068 public postfix func ...<C: Comparable>(c: C) -> OpenEndedInterval<C> { 0069 return OpenEndedInterval(val: c) 0070 } 0071 public postfix func ...<I: ForwardIndexType>(c: I) -> OpenEndedRange<I> { 0072 return OpenEndedRange(val: c) 0073 } 0074 public prefix func ..<<C: Comparable>(c: C) -> OpenStartedIntervalTo<C> { 0075 return OpenStartedIntervalTo(val: c) 0076 } 0077 public prefix func ..<<C: BidirectionalIndexType>(c: C) -> OpenStartedRangeTo<C> { 0078 return OpenStartedRangeTo(val: c) 0079 } 0080 public prefix func ... <C: Comparable>(c: C) -> OpenStartedIntervalThrough<C> { 0081 return OpenStartedIntervalThrough(val: c) 0082 } 0083 public prefix func ... <C: BidirectionalIndexType>(c: C) -> OpenStartedRangeThrough<C> { 0084 return OpenStartedRangeThrough(val: c) 0085 } 0086 0087 // Contains 0088 0089 extension OpenEndedIntervalType { 0090 public func contains(v: Value) -> Bool { return val <= v } 0091 } 0092 extension OpenStartedIntervalTypeTo { 0093 public func contains(v: Value) -> Bool { return val > v } 0094 } 0095 extension OpenStartedIntervalTypeThrough { 0096 public func contains(v: Value) -> Bool { return val >= v } 0097 } 0098 0099 // Pattern Matching 0100 0101 public func ~=<I: OpenIntervalType>(lhs: I, rhs: I.Value) -> Bool { 0102 return lhs.contains(rhs) 0103 } 0104 0105 // Indexing 0106 0107 public extension CollectionType where Index: Comparable { 0108 subscript(r: OpenEndedRange<Index>) -> SubSequence { 0109 return suffixFrom(r.val) 0110 } 0111 } 0112 0113 public extension CollectionType where Index: Comparable, Index: BidirectionalIndexType { 0114 subscript(r: OpenStartedRangeTo<Index>) -> SubSequence { 0115 return prefixUpTo(r.val) 0116 } 0117 subscript(r: OpenStartedRangeThrough<Index>) -> SubSequence { 0118 return prefixThrough(r.val) 0119 } 0120 } 0121 0122 public extension MutableCollectionType where Index: Comparable { 0123 subscript(r: OpenEndedRange<Index>) -> SubSequence { 0124 get { return suffixFrom(r.val) } 0125 set { self[r.val..<endIndex] = newValue } 0126 } 0127 } 0128 0129 public extension MutableCollectionType where Index: Comparable, Index: BidirectionalIndexType { 0130 subscript(r: OpenStartedRangeTo<Index>) -> SubSequence { 0131 get { return prefixUpTo(r.val) } 0132 set { self[startIndex..<r.val] = newValue } 0133 } 0134 subscript(r: OpenStartedRangeThrough<Index>) -> SubSequence { 0135 get { return prefixThrough(r.val) } 0136 set { self[startIndex...r.val] = newValue } 0137 } 0138 }