-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
collect_as is clearly superior to collect in general. However, collect can easily be used in pipes with iterators due to its single argument method. I'd like to use collect_as in pipes, too, without the need to use lambdas.
I see the following possibilities, e.g. for Tuple
- add method
collect_as(::Type{T})which returns a callable to be used as
1:3 |> collect_as(Tuple) .|> println - add method
collect_as_tuple(iterator)to be used as
1:3 |> collect_as_tuple .|> println - add a new function
collect_tuple(iterator)to be used as
1:3 |> collect_tuple .|> println
I think 1. is the most generic interface, has the advantage that no new export is needed, but blocks the single-argument method for future extensions (although it should be fine, I think).
I like 3. a bit more than 2. due to its brevity, which is nice in pipes, although I admit that 2. is less ambiguous.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request