On Thursday, December 5, 2002, at 10:09 AM, Michael Lazzaro wrote:
What about "divvy" (or are we already using that for something else?)
my(@a,@b) = divvy { ... } @c;
Other possibilities from the ol' thesaurus: C<allot>, C<deal>,
C<dole>, C<dispense>.
@$#@%*. Trying to do too many %#@%@ things at once. I meant 'divvy'
instead of 'seperate', not 'purge', obviously (duh). I like Angel's
general theorizing, but maybe we base it on C<for> instead of C<given>?
<thinking aloud...>
Note that this does not generalize for cases > 2. If you want to
split things into, say, three different lists, or five, you have to
use a 'given', and it gets less pleasant. Perhaps a C<divvy> can be a
derivation of C<given> or C<for> by "dividing the streams", either
like this:
my(@a,@b,@c,@d) = divvy {
/foo/ ::
/bar/ ::
/zap/ ::
} @source;
or this (?):
divvy( @source; /foo/ :: /bar/ :: /zap/ ) -> @a, @b, @c, @d;
where C<::> is whatever delimiter we deem appropriate, and an empty
test is taken as the "otherwise" case.
Just pondering. Seems like a useful variation on the whole C<given>
vs. C<grep> vs. C<for> theme, though.
MikeL