Module: EnumerableExtensions

Defined in:
lib/enumerable_extensions.rb

Instance Method Summary collapse

Instance Method Details

#cart_prod(*args) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/enumerable_extensions.rb', line 2

def cart_prod( *args )
  args.inject([[]]){|old,lst|
    new = []
    lst.each{|e| new += old.map{|c| c.dup << e }}
    new
  }
end