One more note:
On Sun, May 7, 2017 at 8:51 PM, Ben Cohen <[email protected]> wrote:
>
> let words = ["five","four","three","two","one","blastoff!"]
> ((0...5).reversed() |> { zip($0, words) })
> .forEach { print($0.0,$0.1, separator: ": ") }
>
> ...
>
> ((0...5).reversed() |> zip(_, words))
> .forEach { print($0.0,$0.1, separator: ": ") }
>
The code above demonstrates that replacing `enumerated` with `zip` gives
you anonymous tuples that need to be accessed with positional properties.
In contrast, the tuple returned from `enumerated` gives you named tuple
(offset: Int, element: Element).
Does this change your opinion when you take into account the sorry state of
tuple handling in Swift 4, that prevents you from writing concise and
readable functional code? See:
SR-4745 for (index, (a, b)) in dict.enumerated() produces an error
https://bugs.swift.org/browse/SR-4745
SR-4738 Can not decompose nested tuple in closure arguments
https://bugs.swift.org/browse/SR-4738
Best regards
Pavol Vaskovic
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution