From: Peter Szinek Date: 2007-01-26T21:50:10+09:00 Subject: Re: cartesian product of arrays Thomas Hafner wrote: > Peter Szinek wrote/schrieb <45B9E90C.7010106@rubyrailways.com>: > >> Also it is maybe more intuitive (for me at least) to write: >> >> first_ary.cartprod second_ary > > How should my example then look like? Well, you are right... it is much less intuitive if you have 3 or more arrays. However, I think your example, i.e. [1,2].cartprod([3,4,5], [6,7,8]) is perfectly OK! Basically what changes is that you will refer to the array [1,2] as self (in Enumerable), and not as the first parameter (as in your original cartprod function). Bye, Peter __ http://www.rubyrailways.com