"William James" <w_a_x_man / yahoo.com> 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