Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: Permuting with duplicates and no memory (off by 1)

by tye (Sage)
on Apr 02, 2007 at 03:11 UTC ( #607748=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Permuting with duplicates and no memory
in thread Permuting with duplicates and no memory

Just FYI, perhaps you missed this bit from the root node:

do { print "@ARGV\n"; } while( nextPermut­e(@ARGV) );

which is also why I called my routine "nextPermute".

Also note that dragonchild's and my iterators can be reused. For yours to be reusable you probably want to change:

return if $i == -1;


if( $i == -1 ) { $first= 1; return; }

- tye        

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://607748]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2016-07-28 10:17 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (253 votes). Check out past polls.