in reply to Re: In need of a sequence iterator.
in thread In need of a sequence iterator.
I had to untangle it from it's dependancies with the object it is a method of, but this produces the sequence as show (prior to scrunching and formatting):
#! perl -slw use strict; sub gen { my( $len, $depth ) = @_; return () unless $len; return map { my $pre = $_; ( $pre, map{ $pre . $_ } gen( $len -1, $depth ) ); } 0 .. $depth - 1; } print for gen( 4, 3 );
|
|---|