I know it's on the CPAN, I just can't find it yet. I want a module which does something like this:
use Number::Properties ':all'; my @odds = grep { odd $_ } @num_list; my @evens = grep { even $_ } @num_list; my @primes = grep { prime $_ } @num_list; my @negatives = grep { negative ...
You get the idea.
Is it out there?
I'm of aware of something exactly like that, although I've hacked stuff similar to it over, e.g., Math::Prime::TiedArray when playing at Project Euler. In fact, gathering all those is_(prime|abundant|fibonacci|*) functions under a Number::Class (still trying to find a better name for it) module is something I want to do when I'll have truckloads of round tuits to spend (ah!).
perl -MNumber::Properties=prime \
-MList::MoreUtils=lastval \
-E '$x = lastval { prime } 2.. Inf;
say "the largest prime number is $x"'
Re:Hm.
Ovid on 2008-02-19T07:00:30
That's beautiful
:)