[thelist] Generating possible combinations without nested loops

Ed at ComSimplicity.com Ed at ComSimplicity.com
Sat Aug 24 18:05:23 CDT 2013


I think the approach you illustrated is the best way to go.  IMO, anything
you do that's trickier would add complexity without benefit.

But I am wondering how you increment a Boolean from 0 to 2...

-----Original Message-----

I've a function test() that takes many (6+) parameters each of which is a
Boolean value. I can call the function in,

for (a in 0...2) {
 for (b in 0...2) {
  for (c in 0...2) {
    test(a,b,c);
   }
  }
}

but I'm wondering if there's a more efficient (or eloquent) way of
generating the required permutations of a,b and c. Ideas?
-- 
Erik Mattheis



More information about the thelist mailing list