キーワード
- & (12)
- * (24)
- + (12)
- - (12)
- <=> (12)
- == (12)
- [] (24)
- []= (24)
- abbrev (12)
- all? (21)
- any? (19)
- at (12)
- bsearch (24)
-
bsearch
_ index (20) - collect (24)
- collect! (24)
- combination (24)
- compact (12)
- compact! (12)
- concat (21)
- count (36)
- cycle (12)
- delete (24)
-
delete
_ at (12) -
delete
_ if (24) - difference (7)
- dig (10)
-
drop
_ while (24) - each (24)
-
each
_ index (12) - empty? (12)
- eql? (12)
- fetch (36)
- fill (24)
- filter (14)
- filter! (14)
-
find
_ index (36) - first (24)
- flatten (12)
- flatten! (12)
- hash (12)
- index (36)
- insert (12)
- inspect (12)
- intersect? (4)
- intersection (6)
- join (12)
-
keep
_ if (24) - last (24)
- length (12)
- map (24)
- map! (24)
- max (18)
- min (18)
- minmax (12)
- none? (7)
- one? (21)
- pack (21)
- permutation (24)
- pop (12)
- product (24)
- reject (24)
- reject! (24)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (12)
-
reverse
_ each (24) - rindex (36)
- rotate (12)
- rotate! (12)
- sample (24)
- select (24)
- select! (24)
- shift (24)
- size (12)
- slice (12)
- slice! (24)
- sort (24)
- sort! (24)
-
sort
_ by! (24) - sum (18)
- take (12)
-
take
_ while (24) -
to
_ a (12) -
to
_ ary (12) -
to
_ csv (12) -
to
_ h (19) -
to
_ s (12) - transpose (12)
- union (7)
- uniq (12)
- uniq! (12)
- unshift (12)
-
values
_ at (12) - zip (24)
- | (12)
検索結果
先頭5件
-
Array
# permutation(n = self . length) { |p| block } -> self (6114.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......st[例][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.permutati......(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 = [... -
Array
# product(*lists) -> Array (6114.0) -
レシーバの配列と引数で与えられた配列(複数可)のそれぞれから要素を1 個ずつとって配列とし,それらのすべての配列を要素とする配列を返します。
...のすべての積にな
ります。
@param lists 配列。複数指定可能。
//emlist[例][ruby]{
[1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
[1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
[1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6],......],[2,4,6]]
[1,2].product() # => [[1],[2]]
[1,2].product([]) # => []
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = []
[1,2,3].product([4,5]) {|e| a << e} #... -
Array
# product(*lists) { |e| . . . } -> self (6114.0) -
レシーバの配列と引数で与えられた配列(複数可)のそれぞれから要素を1 個ずつとって配列とし,それらのすべての配列を要素とする配列を返します。
...のすべての積にな
ります。
@param lists 配列。複数指定可能。
//emlist[例][ruby]{
[1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
[1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
[1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6],......],[2,4,6]]
[1,2].product() # => [[1],[2]]
[1,2].product([]) # => []
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = []
[1,2,3].product([4,5]) {|e| a << e} #... -
Array
# repeated _ combination(n) -> Enumerator (6114.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],......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 (6114.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],......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 _ permutation(n) -> Enumerator (6114.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......mlist[例][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_permutation......).to_a #=> [[]] # one permutation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (6114.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に......mlist[例][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_permutation......).to_a #=> [[]] # one permutation of length 0
//}
ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result... -
Array
# to _ h -> Hash (6114.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...返します。
//emlist[例][ruby]{
bar], [1, 2.to_h # => {:foo => :bar, 1 => 2}
//}
ブロックを指定すると配列の各要素でブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
["foo", "bar"].to_h {|s| [s.ord, s]} # =... -
Array
# to _ h { block } -> Hash (6114.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...返します。
//emlist[例][ruby]{
bar], [1, 2.to_h # => {:foo => :bar, 1 => 2}
//}
ブロックを指定すると配列の各要素でブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
["foo", "bar"].to_h {|s| [s.ord, s]} # =... -
Array
# concat(*other _ arrays) -> self (6109.0) -
other_arrays の要素を自身の末尾に破壊的に連結します。
...other_arrays の要素を自身の末尾に破壊的に連結します。
@param other_arrays 自身と連結したい配列を指定します。
//emlist[例][ruby]{
[ "a", "b" ].concat( ["c", "d"] ) #=> [ "a", "b", "c", "d" ]
[ "a" ].concat( ["b"], ["c", "d"] ) #=> [ "a", "b", "c", "d" ]
[ "a"......].concat #=> [ "a" ]
a = [ 1, 2, 3 ]
a.concat( [ 4, 5 ] )
a #=> [ 1, 2, 3, 4, 5 ]
a = [ 1, 2 ]
a.concat(a, a) #=> [1, 2, 1, 2, 1, 2]
//}
@see Array#+...