944件ヒット
[1-100件を表示]
(0.129秒)
キーワード
- + (12)
- == (12)
- [] (24)
- []= (24)
- abbrev (12)
- all? (21)
- any? (19)
- at (12)
- bsearch (24)
-
bsearch
_ index (20) - collect (12)
- combination (24)
- concat (18)
- count (12)
- cycle (12)
- delete (24)
-
delete
_ at (12) - dig (10)
- empty? (12)
- eql? (12)
- fetch (36)
- filter (7)
- filter! (14)
- first (12)
- hash (12)
- insert (12)
- intersect? (4)
- intersection (6)
-
keep
_ if (24) - last (12)
- map (12)
- max (18)
- min (18)
- minmax (12)
- none? (7)
- one? (21)
- pack (21)
- permutation (12)
- pop (12)
- reject (12)
-
repeated
_ combination (24) -
reverse
_ each (24) - rotate (12)
- rotate! (12)
- sample (24)
- select (12)
- select! (24)
- shift (12)
- slice (12)
- slice! (24)
- sort (24)
- sort! (24)
-
sort
_ by! (24) - sum (18)
-
to
_ h (7) - union (7)
- unshift (12)
-
values
_ at (12) - zip (24)
検索結果
先頭5件
-
Array
# combination(n) -> Enumerator (12214.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......st[例][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 length......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 (12214.0) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......st[例][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 length......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 (12214.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 (12214.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
# sort _ by! -> Enumerator (12208.0) -
sort_by の破壊的バージョンです。
...sort_by の破壊的バージョンです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
fruits = %w{apple pear fig}
fruits.sort_by! { |word| word.length }
fruits # => ["fig", "pear", "apple"]
//}
@see Enumerable#sort_by... -
Array
# sort _ by! {|item| . . . } -> self (12208.0) -
sort_by の破壊的バージョンです。
...sort_by の破壊的バージョンです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
fruits = %w{apple pear fig}
fruits.sort_by! { |word| word.length }
fruits # => ["fig", "pear", "apple"]
//}
@see Enumerable#sort_by... -
Array
# filter! {|item| block } -> self | nil (6320.0) -
ブロックが真を返した要素を残し、偽を返した要素を自身から削除します。 変更があった場合は self を、 変更がなかった場合には nil を返します。
...//emlist[例][ruby]{
a = %w{ a b c d e f }
a.select! {|v| v =~ /[a-z]/ } # => nil
a # => ["a", "b", "c", "d", "e", "f"]
//}
ブロックが与えられなかった場合は、自身と select! から生成した
Enumerator オブジェクトを返します。
@see Array#keep_if, Array#reject!... -
Array
# first -> object | nil (6309.0) -
配列の先頭の要素を返します。要素がなければ nil を返します。
...配列の先頭の要素を返します。要素がなければ nil を返します。
//emlist[例][ruby]{
p [0, 1, 2].first #=> 0
p [].first #=> nil
//}
@see Array#last... -
Array
# last -> object | nil (6309.0) -
配列の末尾の要素を返します。配列が空のときは nil を返します。
...配列の末尾の要素を返します。配列が空のときは nil を返します。
//emlist[例][ruby]{
p [0, 1, 2].last #=> 2
p [].last #=> nil
//}
@see Array#first...