diff --git a/prototype/Doubt/Stream.swift b/prototype/Doubt/Stream.swift index 183f6780a..5b2ffda00 100644 --- a/prototype/Doubt/Stream.swift +++ b/prototype/Doubt/Stream.swift @@ -74,6 +74,14 @@ public enum Stream: NilLiteralConvertible, SequenceType { } + public func zipWith(sequence: S) -> Stream<(A, S.Generator.Element)> { + return Stream<(A, S.Generator.Element)>.unfold((self, Stream(sequence: sequence))) { + guard let (x, xs) = $0.uncons, (y, ys) = $1.uncons else { return nil } + return ((x, y), (xs.value, ys.value)) + } + } + + public init(nilLiteral: ()) { self = .Nil }