Michael Lazzaro wrote:
If we're worried about the distance between the source and destination when there are many tests
Are we? I'm not.
maybe: part { /foo/ => @foo, /bar/ => @bar, /zap/ => @zap }, @source; Or, 'long' formatted: part { /foo/ => @foo, /bar/ => @bar, /zap/ => @zap, }, @source;
I really dislike the use of dative arguments (i.e. those that are modified in-place by a function). Besides, you can already write: push ( /foo/ ?? @foo :: /bar/ ?? @bar :: /baz/ ?? @baz :: [] ), $_ for @source; Heck, even in Perl 5 you can write: push @{ /foo/ ? \@foo : /bar/ ? \@bar : /baz/ ? \@baz : [] }, $_ for @source;
I keep thinking we're missing something here. This is just a multi-streamed C<grep>, after all. It should be easy.
Famous last words. ;-)
Was it ever decided what C<for> would look like with multiple streams?
for zip(@x, @y, @z) -> $x, $y, $z {...} and its operator version: for @x ¦ @y ¦ @z -> $x, $y, $z {...}
Maybe we could just use the stream delimiters in the C<grep> like we do in C<for>?
No. We gave up special stream delimiters in C<for>s, in preference for general zippers. Damian