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