in reply to RE: RE: any-all
in thread any-all
that's untested, but gives you the idea. By the way... poping arrays passed by reference might not be such a good idea either...sub getAnyAll { my $code = shift; my $Any = sub { my @A = @{$_[0]}; # I like to dereference early, it makes my @B = @{$_[1]}; # the rest of the code more readable. while( @A and @B ) { return 1 if &$code( pop(@A), pop(@B) ) } return 0 }; my $All = sub { my @A = @{$_[0]}; my @B = @{$_[1]}; while( @A and @B ) { return 0 unless &$code( pop(@A), pop(@B) ) } return 1 }; return ( $Any, $All ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: RE: any-all
by fundflow (Chaplain) on Sep 02, 2000 at 02:31 UTC | |
by Adam (Vicar) on Sep 02, 2000 at 03:15 UTC |