1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Add a concat overload over Memo<Stream>.

This commit is contained in:
Rob Rix 2015-09-17 14:34:39 -04:00
parent 25a88b3c69
commit afaa68b1e0

View File

@ -47,10 +47,14 @@ public enum Stream<A>: NilLiteralConvertible, SequenceType {
}
public func concat(other: Stream) -> Stream {
public func concat(other: Memo<Stream>) -> Stream {
return analysis(
ifCons: { .Cons($0, $1.map { $0.concat(other) }) },
ifNil: const(other))
ifCons: { .Cons($0, $1.map { $0.concat(other.value) }) },
ifNil: { other.value })
}
public func concat(other: Stream) -> Stream {
return concat(Memo(evaluated: other))
}