88件ヒット
[1-88件を表示]
(0.206秒)
ライブラリ
- ビルトイン (88)
クラス
- Array (88)
キーワード
- permutation (22)
-
repeated
_ combination (22) -
repeated
_ permutation (22)
検索結果
先頭5件
-
Array
# combination(n) -> Enumerator (18380.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......emlist[例][ruby]{
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of le......h 0
a.combination(5).to_a #=> [] : no combinations of length 5
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # =>... -
Array
# combination(n) {|c| block } -> self (18380.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......emlist[例][ruby]{
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of le......h 0
a.combination(5).to_a #=> [] : no combinations of length 5
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # =>... -
Array
# repeated _ combination(n) -> Enumerator (12374.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......指定した場合に発生します。
//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(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a... -
Array
# repeated _ combination(n) { |c| . . . } -> self (12374.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......指定した場合に発生します。
//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(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a... -
Array
# permutation(n = self . length) -> Enumerator (6330.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.per......e permutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e... -
Array
# permutation(n = self . length) { |p| block } -> self (6230.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.per......e permutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e... -
Array
# repeated _ permutation(n) -> Enumerator (6230.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......//emlist[例][ruby]{
a = [1, 2]
a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permut......#=> [[]] # one permutation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (6230.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......//emlist[例][ruby]{
a = [1, 2]
a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permut......#=> [[]] # one permutation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1...