155件ヒット
[1-100件を表示]
(0.109秒)
別のキーワード
キーワード
- clone (12)
- concat (21)
- dup (12)
- fetch (12)
- none? (7)
- one? (7)
- permutation (24)
-
repeated
_ combination (24) -
repeated
_ permutation (24) -
to
_ csv (12)
検索結果
先頭5件
-
Array
# repeated _ permutation(n) -> Enumerator (18303.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......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_permutation(0).to_a #=> [[]] # one perm......utation 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... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (18303.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......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_permutation(0).to_a #=> [[]] # one perm......utation 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... -
Array
# permutation(n = self . length) -> Enumerator (12203.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......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.permutation(0).to_a #=> [[]]: one per......mutation 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| res... -
Array
# permutation(n = self . length) { |p| block } -> self (12203.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......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.permutation(0).to_a #=> [[]]: one per......mutation 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| res... -
Array
# repeated _ combination(n) -> Enumerator (12202.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...ブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......peated_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],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.repeated_combination......,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 (12202.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...ブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......peated_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],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.repeated_combination......,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
# none?(pattern) -> bool (6202.0) -
ブロックを指定しない場合は、 配列のすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...返します。
@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。
//emlist[例][ruby]{
%w{ant bear cat}.none? {|word| word.length == 5} # => true
%w{ant bear cat}.none? {|word| word.length >= 4} # => false
%w{ant bear cat}.none?(/d/)......# => true
[].none? # => true
[nil].none? # => true
[nil,false].none? # => true
[nil, false, true].none? # => false
//}
@see Enumerable#none?... -
Array
# one?(pattern) -> bool (6202.0) -
ブロックを指定しない場合は、 配列の要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。
...返します。
@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。
//emlist[例][ruby]{
%w{ant bear cat}.one? {|word| word.length == 4} # => true
%w{ant bear cat}.one? {|word| word.length > 4} # => false
%w{ant bear cat}.one?(/t/)......# => false
[ nil, true, 99 ].one? # => false
[ nil, true, false ].one? # => true
[ nil, true, 99 ].one?(Integer) # => true
[].one? # => false
//}
@see Enumerable#one?... -
Array
# clone -> Array (6126.0) -
レシーバと同じ内容を持つ新しい配列を返します。
...レシーバと同じ内容を持つ新しい配列を返します。
clone は frozen singleton-class の情報も含めてコピーしますが、
dup は内容と tainted だけをコピーします。
またどちらのメソッドも要素それ自体のコピーはしません。
つまり......ているオブジェクトが変わらない「浅い(shallow)」コピーを行います。
//emlist[例][ruby]{
ary = ['string']
p ary #=> ["string"]
copy = ary.dup
p copy #=> ["string"]
ary[0][0...3] = ''
p ary #=> ["ing"]
p copy #=> ["ing"]
//}......レシーバと同じ内容を持つ新しい配列を返します。
clone は frozen singleton-class の情報も含めてコピーしますが、
dup は内容だけをコピーします。
またどちらのメソッドも要素それ自体のコピーはしません。
つまり参照して......いるオブジェクトが変わらない「浅い(shallow)」コピーを行います。
//emlist[例][ruby]{
ary = ['string']
p ary #=> ["string"]
copy = ary.dup
p copy #=> ["string"]
ary[0][0...3] = ''
p ary #=> ["ing"]
p copy #=> ["ing"]
//}... -
Array
# dup -> Array (6126.0) -
レシーバと同じ内容を持つ新しい配列を返します。
...レシーバと同じ内容を持つ新しい配列を返します。
clone は frozen singleton-class の情報も含めてコピーしますが、
dup は内容と tainted だけをコピーします。
またどちらのメソッドも要素それ自体のコピーはしません。
つまり......ているオブジェクトが変わらない「浅い(shallow)」コピーを行います。
//emlist[例][ruby]{
ary = ['string']
p ary #=> ["string"]
copy = ary.dup
p copy #=> ["string"]
ary[0][0...3] = ''
p ary #=> ["ing"]
p copy #=> ["ing"]
//}......レシーバと同じ内容を持つ新しい配列を返します。
clone は frozen singleton-class の情報も含めてコピーしますが、
dup は内容だけをコピーします。
またどちらのメソッドも要素それ自体のコピーはしません。
つまり参照して......いるオブジェクトが変わらない「浅い(shallow)」コピーを行います。
//emlist[例][ruby]{
ary = ['string']
p ary #=> ["string"]
copy = ary.dup
p copy #=> ["string"]
ary[0][0...3] = ''
p ary #=> ["ing"]
p copy #=> ["ing"]
//}...