daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest May 16th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct LargeArray: Sequence {
  2.     var contents: (Int * 10000)
  3.    
  4.     func makeIterator() -> Iter {
  5.         return Iter(array: self, index: 0)
  6.     }
  7. }
  8.  
  9. struct Iter: IteratorProtocol {
  10.     var array: LargeArray
  11.     var index = 0
  12.    
  13.     mutating func next() -> Int? {
  14.         defer { index += 1 }
  15.         return array[index]
  16.     }
  17. }
RAW Paste Data
Top