From: Paolo Bonzini Date: 2008-01-10T22:29:58+09:00 Subject: Re: method that generate block? > def cart_prod( *args ) > args.inject([[]]){|old,lst| > new = [] > lst.each{|e| new += old.map{|c| c.dup << e }} > new > } > end > > The problem is this method take arrays as argument, how can I pass into > only one array as argument? (this one array will contains sub arrays > that I want to make a cartesian product from, for example: vds = > [[1,2],["a","b"]], how to pass the vds array into the method to get > cartesian product of [1,2] and ["a","b"]?) Remove the * from *args. Paolo