On Thu, 29 May 2003 14:01:45 +0900, Mark Wilson wrote:

> The following is a proposed implementation of a cartesian product 
> method for the set class. Comments and suggestions would be welcome.


I was playing around with Array#foldr and made this piece of code:

def cproduct(a, b)
  a.foldr([]) do |rx, x|
    rx + b.foldr([]) { |ry, y| ry + [[x, y]] }
  end
end



The Array#foldl  is located here:
http://www.rubygarden.org/ruby?ArrayFold


--
Simon Strandgaard