There has been a lot of discussion in the other threads lately about iterators. I was wondering if there will be an easy way to create a bidirectional iterator? Toy example to show what I'm thinking:
for(1..10) { next if /7/; # always skip 7 prev if 9 && !rand 3; # occasionally backup and redo 8 print; } More significant example: class BigNum is Iterator:bi { has [EMAIL PROTECTED] is Iterator:bi; ...; method postfix:*=($arg) { my @temp is Iterator:bi; my $carry = 0; for ([EMAIL PROTECTED]:last_to_first) { my $num = $_ * $arg + $carry; my $val = $num % 10; $carry = int( $num / 10 ); unshift @temp, $val; # efficient because it's a bi Iter } [EMAIL PROTECTED] = @temp; } }; Sometimes an iterator cannot be bidirectional--for example, reading from STDIN--but that's fine; not all iterators need to be. And yes, if I want a linked list, I can use a module off the 6PAN, or write it myself, but that involves objects and methods. That's a lot of conceptual overhead for something that may be quite simple. --Dks -- [EMAIL PROTECTED]