Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c = CartesianProduct.new([:a,:b], [4,5])
- c.each { |elt| puts elt.inspect }
- # [:a, 4]
- # [:a, 5]
- # [:b, 4]
- # [:b, 5]
- c = CartesianProduct.new([:a,:b], [])
- c.each { |elt| puts elt.inspect }
- # (nothing printed since Cartesian product
- # of anything with an empty collection is empty)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement