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:
parent
25a88b3c69
commit
afaa68b1e0
@ -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))
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user