Re: Every.pm on CPAN
by David Nicol other posts by this author
Jul 18 2008 12:16PM messages near this date
Re: Every.pm on CPAN
|
Re: Every.pm on CPAN
On Fri, Jul 18, 2008 at 1:19 PM, Gisle Aas <gisle@[...].com> wrote:
> > it's really useful and the common (if $i % 5 == 0) format has lots of
> > shortcomings;
>
> What would those shortcoming be? I've never been bothered by that idiom.
me neither. The following may or may not work today, but demonstrates
what Macrame's EXPAND is all about.
use Macrame;
macro every(N) {
EXPAND {
$Macrame::Expand::EveryInstanceCounter++;
my $count;
*{"Macrame::Expand::EveryInstance".$Macrame::Expand::EveryInstanceCounter}
= sub {
! ( ++$count % N )
};
"(&Macrame::Expand::EveryInstance".$Macrame::Expand::EveryInstanceCounter.")"
}
}
macro every N { every (N) }
Thread:
Ted Zlatanov
Abigail
Ted Zlatanov
Ben Morrow
Roland Giersig
David Nicol
Ted Zlatanov
Ted Zlatanov
David Nicol
Ben Morrow
Ted Zlatanov
Chromatic
Aristotle Pagaltzis
Nicholas Clark
Yitzchak Scott-Thoennes
David Nicol
Ted Zlatanov
Abigail
Ted Zlatanov
Abigail
David Nicol
Ted Zlatanov
Aristotle Pagaltzis
Ted Zlatanov
David Cantrell
David Nicol
Eric Wilhelm
David Nicol
Ben Morrow
Aristotle Pagaltzis
Paul Johnson
David Nicol
Eric Brine
Gisle Aas
David Nicol
Nicholas Clark
|