Skip to content

Instantly share code, notes, and snippets.

@bryanl
Created March 8, 2014 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanl/9423216 to your computer and use it in GitHub Desktop.
Save bryanl/9423216 to your computer and use it in GitHub Desktop.
def multi_cartesian(array)
array[1..-1].inject(array[0]) do |m,n|
m = m.product(n).map(&:flatten)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment