Sha256: 8e1474bf61b822e9e1aa98ecf99527e491ec4e7e2ebae12a0b0abad9bff2d9ff
Contents?: true
Size: 577 Bytes
Versions: 1
Compression:
Stored size: 577 Bytes
Contents
require 'nano/enumerable/cross' module Enumerable # Operator alias for cross-product. # # a = [1,2] ** [4,5] # a #=> [[1, 4],[1, 5],[2, 4],[2, 5]] # def **(enum) Enumerable.cross(self, enum) end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCEnumerable < Test::Unit::TestCase def test_op_pow a = [1,2,3] ** [4,5,6] assert_equal( [[1, 4],[1, 5],[1, 6],[2, 4],[2, 5],[2, 6],[3, 4],[3, 5],[3, 6]], a ) end end =end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.9.0 | lib/nano/enumerable/op_pow.rb |