ライブラリ
- ビルトイン (155)
キーワード
- [] (33)
- combination (22)
- none? (6)
- one? (6)
- permutation (22)
-
repeated
_ combination (22) -
repeated
_ permutation (22) -
sort
_ by! (11)
検索結果
先頭5件
-
Array
# at(nth) -> object | nil (15107.0) -
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
@param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックスと見倣します。末尾の要素が -1 番目になります。
整数以外のオブジェクトを指定した場合は to_int メソッドによる
暗黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定... -
Array
# repeated _ combination(n) -> Enumerator (12307.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、
組み合わせを生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェ......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|......result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see Array#repeated_permutation, Array#combination... -
Array
# repeated _ permutation(n) -> Enumerator (12307.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...実行します。
得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェ......ation(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_permutation(0).to_a #=> [[]] # one permutation of length......ロックを実
行して 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 _ combination(n) { |c| . . . } -> self (12207.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、
組み合わせを生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェ......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|......result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}
@see Array#repeated_permutation, Array#combination... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (12207.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...実行します。
得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェ......ation(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_permutation(0).to_a #=> [[]] # one permutation of length......ロックを実
行して 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
# permutation(n = self . length) -> Enumerator (6315.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...行します。
得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェク......mutation(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.permutation(0).to_a #=> [[]]: one 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| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Array
# permutation(n = self . length) { |p| block } -> self (6215.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...行します。
得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェク......mutation(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.permutation(0).to_a #=> [[]]: one 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| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
Array
# combination(n) -> Enumerator (6213.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、組み合わせ
を生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェ......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 length 0
a.combination(5).to_a......た配列の各要素を引数としてブロックを実
行して 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 (6113.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、組み合わせ
を生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェ......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 length 0
a.combination(5).to_a......た配列の各要素を引数としてブロックを実
行して 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
# [](start , length) -> Array | nil (147.0) -
start 番目から length 個の要素を含む部分配列を返します。 start が自身の範囲外となる時は nil を返します。ただし、start が配列の長さに等しいときは空の配列を返します。 length が負の時は nil を返します。
...start 番目から length 個の要素を含む部分配列を返します。
start が自身の範囲外となる時は nil を返します。ただし、start が配列の長さに等しいときは空の配列を返します。
length が負の時は nil を返します。
@param start 生成......した場合は to_int メソッドによ
る暗黙の型変換を試みます。
@param length 生成したい部分配列の長さを整数で指定します。
length が start 番目からの配列の長さより長い時には、越え
た分の長さ...