From: walter a kehowski Date: 2005-08-07T19:11:07+09:00 Subject: Re: cartesian product "Giovanni Intini" wrote in message news:a32174e30508070301673ce4d1@mail.gmail.com... Remember that in Ruby you seldom have standalone functions. You should probably create a class that has the cartprod method. Giovanni, Here's what I have so far: def cartprod(a,b) c=[] a.each do |ae| b.each do |be| c << [ae, be] end end return c end a=[1,2,3] b=[4,5,6] c=cartprod(a,b) c.each { |ce| print ce,"\n" } 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? Walter Kehowski