Skip to content

Instantly share code, notes, and snippets.

@bval
Forked from fapestniegd/gist:1761728
Created February 7, 2012 20:37
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 bval/1761786 to your computer and use it in GitHub Desktop.
Save bval/1761786 to your computer and use it in GitHub Desktop.
[ ["-71", "-49"], ["-47", "-37"], ["-73"] ] =returns=> [ ["-71", "-47", "-73"] ["-71", "-37", "-73"] ["-49", "-47", "-73"] ["-49", "-37", "-73"] ]
or
[
["-71", "-49"],
["-47", "-37"],
["-73"]
]
returns
[
["-71", "-47", "-73"]
["-71", "-37", "-73"]
["-49", "-47", "-73"]
["-49", "-37", "-73"]
]
set = Set.new ["-71", "-49"]
set.cartesian_product( ["-47", "-37"], ["-73"] )
#<Set: {#<Set: {"-71", "-73", "-47"}>, #<Set: {"-49", "-73", "-47"}>, #<Set: {"-71", "-73", "-37"}>, #<Set: {"-49", "-73", "-37"}>}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment