in reply to Re: Generate all (0,1)-sequences in lexicographic order
in thread Generate all (0,1)-sequences in lexicographic order

Why do you need both @seqs_0 and @seqs_1? They'll both hold the same thing, and you're dealing with them destructively. Unless I'm missing something, I'd think you could do

my @subseq = gen_seqs($n-1); unshift @$seq, 0 foreach @subseq; unshift @$seq, 1 foreach @subseq; push @seqs, @subseq, @subseq;

Hmm? The idea is to generate two copies of the (n-1)-sequences, prepend a 0 to everything in the first copy, and prepend a 1 to everything in the second copy. Unless I'm missing something (perhaps about $seq, which you don't declare here and which I don't use except in the code that I think you're replacing), you'll stuff a 0 onto each sequence in @subseq, then a 1 onto each sequence, and throw two copies of that into @seqs. Not the same thing.

I could easily be missing something, though. I'm in the middle of debugging some backtracking code right before a deadline, so I'm not thinking terribly clearly at the moment. :-) Thanks for taking the time to look it over.

--
F o x t r o t U n i f o r m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!