https://medium.com/swift-programming/sequence-beyond-primitive-iterations-in-swift-80bc2507d8cc
/// Return a `GeneratorType` instance whose `next` method invokes /// `body` and returns the result. /// /// Example: /// /// var x = 7 /// let g = anyGenerator { x < 15 ? x++ : nil } /// let a = Array(g) // [ 7, 8, 9, 10, 11, 12, 13, 14 ] @warn_unused_result public func anyGenerator<Element>(body: () -> Element?) -> AnyGenerator<Element>