Re: [code-review] Algorithm::GenerateSequence

Steffen Müller <[email protected]> Mon, 08 Sep 2003 11:22:07 +0200
Newsgroups gmane.comp.lang.perl.code-review-ladder
Message-ID <[email protected]>
Andrew Savige wrote:
[...]
> It looks excellent to me, but I'm very new to all this iterator/
> generator business in Perl. I heard MJD is fanatical on this stuff,
> but I couldn't find any useful free stuff at at http://www.plover.com/.
[...]

MJD's upcoming book is going to devote at least a chapter to the topic. 
While it's been taking a long while, I read a few of his drafts and I 
expect the book to be very good.

On a more on-topic note: I can't find the original mail, but I suspect 
that if you used closures instead of OO, you could get some speed-up. 
(The module *was* OO, right?)

Like:
sub new {
	# get data...
	return sub {
		# Do the permutation/etc here
	};
}

my $perms = Package::Name->new(@data);
while ($_ = $perms->()) {
	# do work
}

Steffen