On Fri, Nov 18, 2005 at 11:36:33 -0800, Larry Wall wrote: > If we had some kind of partitioning operator, it'd probably be generalized > to sorting into bins by number, where 0 and 1 are degenerate cases for > booleans. But since we'd almost certainly make the general form > > (@bin0, @bin1, @bin2...) := classify { calc_int($_ } LIST;
For me it seems to make more sense that in the higher-order scheme of things classify presents functions to it's body. Instead of relying on the return value from the body, it gets a number of functions that it can invoke to append a function. This is more general since it allows classification to include duplicates. Grep is simply: sub grep (&filter, [EMAIL PROTECTED]) { classify -> $x, &f { f($x) if filter($x); } [EMAIL PROTECTED]; } -- () Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker & /\ kung foo master: /me does not drink tibetian laxative tea: neeyah!
pgpJajdFgPsEB.pgp
Description: PGP signature