[thelist] Generating possible combinations without nested loops

erik mattheis gozz at gozz.com
Fri Aug 23 21:29:01 CDT 2013


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

http://www.flickr.com/gelk


More information about the thelist mailing list