Re: enumerating subarrays

2009-04-06 Thread Jim Gibson
On 4/4/09 Sat Apr 4, 2009 8:34 PM, Andrew Fithian afit...@gmail.com scribbled: What's a slick way to enumerate all subarrays of length n from a master array of length m? For example I've been enumerating all possible two card hands from a deck of 52 cards (n=2, m=52) using nested for loops:

enumerating subarrays

2009-04-04 Thread Andrew Fithian
What's a slick way to enumerate all subarrays of length n from a master array of length m? For example I've been enumerating all possible two card hands from a deck of 52 cards (n=2, m=52) using nested for loops: for ( $i = 0 ; $i $#deck ; $i++ ) { for ( $j = $i+1 ; $j = $#deck ; $j++ )