Slide 73
Slide 73 text
Composition
func zip(
_ a: [A],
_ b: [B],
with f: @escaping (A, B) -> C
) -> [C] {
a.flatMap { x in
b.map { y in f(x, y) }
}
}
func zip(
_ a: Result,
_ b: Result,
with f: @escaping (A, B) -> C
) -> Result {
a.flatMap { x in
b.map { y in f(x, y) }
}
}