On Thursday, December 5, 2002, at 07:55 PM, Damian Conway wrote:
I worry that C<classify> sounds too much like something class-related, and would confuse people. What about C<arrange> or something? Decent thesaurus entries for <separate> include:equally. The built-in would actually be doing classification of the elements of the list, so it ought to be called C<classify>.
assign, classify, comb, compartmentalize, discriminate, distribute, group, order, segregate, sift, winnow, amputate, cut, dismember, excise, lop, disunite, divorce, estrange, part, wean, detach, disconnect, disengage, dissociate, extract, isolate, part, steal, take, uncouple, withdraw
Some of those might be appropriate (or just amusing). :-)
How would you do something like:The selector block/closure would, naturally, be called in C<int> context each time, so (again, as Larry pointed out) a boolean function would naturally classify into two arrays. Though it
(@foo,@bar,@zap) := classify { /foo/ ;; /bar/ ;; /zap/ } @source;
I was more hoping for a C<for> or C<given> derivative that would provide a series of 'stream'-like tests, not just one test with N answers. Something that was a shorthand for the obvious but somewhat tedious C<given> counterpart. (If @source had an entry 'foobar', we could debate whether that should go in one destination stream or two.)
I don't think we need a separate func either, but if we're gonna have a purge/vrep/antigrep, can someone _please_ think of a better name for it? "purge" clearly needs an inverse called "binge", "vrep" sounds like, well, UNIX, and "antigrep" sounds like something I put in my car to avoid it grepping when I start it on cold mornings.Especially since you then get your purge/vrep/antigrep for free:
Even just "ngrep" sounds better to me. :-|
MikeL