From: daz Date: 2005-08-07T19:21:07+09:00 Subject: Re: cartesian product walter a kehowski wrote: > > > Here's what I have so far: > [code] > > and this does print all the elements of c. > Great. Now how do I do a class? > Can I create a new method for Array? > class Array def cartprod(b) c=[] each do |ae| b.each do |be| c << [ae, be] end end c end end a=[1,2,3] b=[4,5,6] c = a.cartprod(b) c.each { |ce| p ce } daz