in reply to Re: iter
in thread iter
That said, my solution is pretty ugly in comparison :)
update: After running some benchmarks, it's apparent that my solution is less efficient (by a factor of about 7x when iterating on each individual item), since the built-in splice is considerably faster than a re-implementation of a non-destructive splice in Perl. (though, my iter does outperform the OO iter when iterating and returning segments of length 100 or greater {really big grin})
So without further ado, -- this quote-unquote craft, and forget I ever wrote this piece of schnapz.
update2: Oh yeah, I forgot to mention, you wrote alot of code! :p
sub iter { my @a = @_; sub { splice @a, 0, shift || 1 }; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: iter
by Dominus (Parson) on Mar 28, 2001 at 07:10 UTC | |
by MeowChow (Vicar) on Mar 28, 2001 at 07:50 UTC |