From: Thomas Hafner Date: 2007-02-03T07:10:31+09:00 Subject: Re: cartesian product of arrays "William James" wrote/schrieb <1170361559.491476.96660@p10g2000cwp.googlegroups.com>: > Here's a shorter but slower way. > > def cart_prod( *args ) > args.inject([[]]){|old,lst| > lst.inject([]){|new,e| > new + old.map{|c| c.dup << e}}} > end Wow, it's really short. Maybe it's not slower at all. Did you just that? Or did you compare it actually? Regards Thomas