るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.329秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:_builtin[x] > クエリ:repeated_combination[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

キーワード

検索結果

Array#repeated_combination(n) -> Enumerator (26140.0)

サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。

...定した場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],...
...3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e|...

Array#repeated_combination(n) { |c| ... } -> self (26140.0)

サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。

...定した場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],...
...3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e|...

Array#combination(n) -> Enumerator (8008.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...た配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#combination(n) {|c| block } -> self (8008.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...た配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#repeated_permutation(n) -> Enumerator (8008.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...ロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...

絞り込み条件を変える

Array#repeated_permutation(n) { |p| ... } -> self (8008.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...ロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...