mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Memo does not need the evaluated label.
This commit is contained in:
parent
8387f5ce71
commit
6e0cf0d6a1
@ -3,7 +3,7 @@ public struct Memo<A> {
|
||||
self.init(.Unevaluated(unevaluted))
|
||||
}
|
||||
|
||||
public init(evaluated: A) {
|
||||
public init(_ evaluated: A) {
|
||||
self.init(.Evaluated(evaluated))
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public enum Stream<A>: NilLiteralConvertible, SequenceType {
|
||||
}
|
||||
|
||||
public var rest: Memo<Stream> {
|
||||
return analysis(ifCons: { $1 }, ifNil: { Memo(evaluated: .Nil) })
|
||||
return analysis(ifCons: { $1 }, ifNil: { Memo(.Nil) })
|
||||
}
|
||||
|
||||
public var isEmpty: Bool {
|
||||
@ -59,7 +59,7 @@ public enum Stream<A>: NilLiteralConvertible, SequenceType {
|
||||
}
|
||||
|
||||
public func concat(other: Stream) -> Stream {
|
||||
return concat(Memo(evaluated: other))
|
||||
return concat(Memo(other))
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ public enum Stream<A>: NilLiteralConvertible, SequenceType {
|
||||
|
||||
|
||||
public func generate() -> AnyGenerator<A> {
|
||||
var current = Memo(evaluated: self)
|
||||
var current = Memo(self)
|
||||
return anyGenerator {
|
||||
let next = current.value.first
|
||||
current = current.value.rest
|
||||
|
@ -8,7 +8,7 @@ public enum Vertex<Element> {
|
||||
case let .XY(_, xs, _):
|
||||
return xs
|
||||
case .End:
|
||||
return Memo(evaluated: .End)
|
||||
return Memo(.End)
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,14 +17,14 @@ public enum Vertex<Element> {
|
||||
case let .XY(_, _, ys):
|
||||
return ys
|
||||
case .End:
|
||||
return Memo(evaluated: .End)
|
||||
return Memo(.End)
|
||||
}
|
||||
}
|
||||
|
||||
public var diagonal: Memo<Vertex> {
|
||||
return right.flatMap { $0.down }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public init<A, B>(rows: Stream<A>, columns: Stream<B>, combine: (A, B) -> Element) {
|
||||
self = columns
|
||||
|
Loading…
Reference in New Issue
Block a user