From: "Peña, Botp" Date: 2002-11-15T10:38:25+09:00 Subject: Re: Product with filters cool. Have you added this to the Rubygarden wiki? ...preferably under algorithms? > martindemello@yahoo.com [mailto:martindemello@yahoo.com] said: > .... > # A modification of Joel VanderWerf's > EnumerableOperator#product to include > # restrictions ('select' style filters that are applied as > the product is # constructed). Behaviour defaults to the > Cartesian product when no filters are # given. (List > comprehension envy again ) # > # The argument list consists of a mixture of factors > (Enumerable objects) # and restrictions (procs returning a boolean). > # > # Factors appear in order; restrictions are sorted by arity, > so that a # restriction of arity n is applied after the nth > element in every tuple is # added. > [snipped code]