mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
map using analysis to work around a compiler crash.
This commit is contained in:
parent
ab6cb6c67b
commit
87e4d6ccfc
@ -41,7 +41,11 @@ public enum Stream<A>: NilLiteralConvertible, SequenceType {
|
||||
|
||||
|
||||
public func map<B>(transform: A -> B) -> Stream<B> {
|
||||
return uncons.map { first, rest in Stream<B>.Cons(transform(first), Memo { rest.map(transform) }) } ?? Stream<B>.Nil
|
||||
return analysis(
|
||||
ifCons: { first, rest in
|
||||
.Cons(transform(first), rest.map { $0.map(transform) })
|
||||
},
|
||||
ifNil: { nil })
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user