1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Add row/column implementations back using Stream.unfold.

This commit is contained in:
Rob Rix 2015-09-25 12:37:58 -04:00
parent 21f3bc9dcc
commit 652d1f9db4

View File

@ -34,6 +34,22 @@ public enum Vertex<Element> {
}
public var row: Stream<Element> {
return Stream.unfold(Memo(evaluated: self)) {
$0.value.analysis(
ifXY: { here, across, _ in .Some(here, across) },
ifEnd: const(nil))
}
}
public var column: Stream<Element> {
return Stream.unfold(Memo(evaluated: self)) {
$0.value.analysis(
ifXY: { here, _, down in .Some(here, down) },
ifEnd: const(nil))
}
}
public init<S1: SequenceType, S2: SequenceType>(rows: S1, columns: S2, combine: (S1.Generator.Element, S2.Generator.Element) -> Element) {
let rows = Stream(sequence: rows)
let columns = Stream(sequence: columns)