Sha256: 0af0222054756c36799ac24aba6e8ecbe64d1d3446eda83b233ef2a7a31bceb0
Contents?: true
Size: 353 Bytes
Versions: 7
Compression:
Stored size: 353 Bytes
Contents
== Array#combination require 'facets/array/combination' finds pairs of combinations e = [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]] a = [1,2,3,4] r = a.combination(2).to_a r.assert == e can also take a block e = [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]] r = [] a = [1,2,3,4] a.combination(2){ |a,b| r << [a,b] } r.assert == e
Version data entries
7 entries across 7 versions & 1 rubygems