mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Stream.map.
This commit is contained in:
parent
0dfd3a5ecd
commit
9c47dae557
@ -34,4 +34,9 @@ public enum Stream<A> {
|
||||
public var isEmpty: Bool {
|
||||
return uncons == nil
|
||||
}
|
||||
|
||||
|
||||
public func map<B>(transform: A -> B) -> Stream<B> {
|
||||
return uncons.map { first, rest in Stream<B>.Cons(transform(first), { rest.map(transform) }) } ?? Stream<B>.Nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user