Front page | perl.perl6.language |
Postings from July 2006
From: Aaron Sherman
July 11, 2006 13:22
Message ID: 1152649332.28796.391.camel@pps
On Tue, 2006-07-11 at 12:50 -0700, Trey Harris wrote:
> > But I don't think that will do, because it fails when you don't know
> > WHICH list would be the longest (or you have to specify them all
> > as :with, and that's rather counter-intuitive). Perhaps a stand-alone
> > adverb, :parity makes more sense.
> I don't understand how the word "parity" is being used here... It's not
> in the mathematical sense of "even vs. odd", nor in the telecomm sense of
> bit-counting (since one would want to stop if one out of four iterators
> stopped generating, but also if two out of four did). In the colloquial
> sense of parity meaning "equality amongst peers", perhaps it makes more
> sense, but it's a rather overloaded an poorly-understood word, IMHO.
Yeah, I see your problem. I WAS using the "equality amongst peers"
definition, but you're probably right that there's too much baggage.
Having read and digested the rest of your mail and your comments on IRC,
let me propose (as I did on IRC before you had to run):
zip(:fewest, @a;@b;@c); # Until one runs out
zip(:finite, @a;@b;@c); # Stop if only known-infinite ranges are left
roundrobin(:most, @a;@b;@c); # Include undefs until all arrays empty
zip(@a;@b:fewest;@c); # empty @b, then stop.
zip(@a:fewest;@b;@c:fewest); # stop when non - @b is empty
zip(@a:fewest;@b:fewest;@c:fewest); # Same as stand-alone :fewest
roundrobin(@a;@b:most;@c); # fill in undefs for @b until @a,@c empty
roundrobin(@a:most;@b;@c:most); # fill in undefs for all but @b
roundrobin(@a:most;@b:most;@c:most); # Same as stand-alone :most
I think that covers all of the bases that I, you and Larry proposed.
I'm still not clear on how :fewest and :most modify a container, but I'm
convinced that once I make sense of it, there will be other ways in
which I want to use that modifier.
Aaron Sherman <email@example.com>
Senior Systems Engineer and Toolsmith
"We had some good machines, but they don't work no more." -Shriekback