別のキーワード
キーワード
- * (22)
- + (11)
- << (11)
- []= (33)
- abbrev (11)
- all? (18)
- any? (27)
- append (7)
- assoc (11)
- clear (11)
- clone (11)
- collect (22)
- collect! (22)
- compact (11)
- compact! (11)
- concat (19)
- delete (22)
-
delete
_ at (11) -
delete
_ if (22) - drop (11)
-
drop
_ while (22) - dup (11)
- empty? (11)
- fetch (33)
- fill (66)
-
find
_ index (33) - first (22)
- flatten (11)
- flatten! (11)
- index (33)
- insert (11)
- inspect (11)
- join (11)
-
keep
_ if (22) - last (22)
- length (11)
- map (22)
- map! (22)
- none? (6)
- one? (6)
- pack (19)
- permutation (22)
- pop (22)
- prepend (7)
- product (22)
- push (11)
- rassoc (11)
- reject! (22)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - replace (11)
- reverse (11)
- reverse! (11)
- rindex (33)
- sample (44)
- shift (22)
- size (11)
- slice (33)
- sort (22)
- sort! (22)
- sum (8)
-
to
_ csv (11) -
to
_ s (11) - transpose (11)
- uniq (22)
- uniq! (22)
- unshift (11)
-
values
_ at (11) - zip (22)
検索結果
先頭5件
-
Array
# repeated _ permutation(n) -> Enumerator (12203.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......ロックを実
行して 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 _ permutation(n) { |p| . . . } -> self (12203.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......ロックを実
行して 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
# pack(template) -> String (6252.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...配列の内容を template で指定された文字列にしたがって、
バイナリとしてパックした文字列を返します。
テンプレートは
型指定文字列とその長さ(省略時は1)を並べたものです。長さと
して * が指定された時は「残りのデ......指定文字は以下で述べる pack テンプレート文字列の通りです。
@param template 自身のバイナリとしてパックするためのテンプレートを文字列で指定します。
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の......ort
i,i!: signed int
I,I!: unsigned int
l!: signed long
L!: unsigned long
q!: signed long long
Q!: unsigned long long
j,j!: intptr_t
J,J!: uintptr_t
//}
: エンディアン依存、整数サイズ非依存 (C99 の stdint.h にある厳密な幅を持つ整数型に適切)
//emlist......」の長さを
表します。型指定文字は以下で述べる pack テンプレート文字列の通りです。
buffer が指定されていれば、バッファとして使って返値として返します。
もし template の最初にオフセット (@) が指定されていれば、
結......してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。
//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}
@param template 自身のバイナリとしてパックす... -
Array
# pack(template , buffer: String . new) -> String (6252.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...配列の内容を template で指定された文字列にしたがって、
バイナリとしてパックした文字列を返します。
テンプレートは
型指定文字列とその長さ(省略時は1)を並べたものです。長さと
して * が指定された時は「残りのデ......」の長さを
表します。型指定文字は以下で述べる pack テンプレート文字列の通りです。
buffer が指定されていれば、バッファとして使って返値として返します。
もし template の最初にオフセット (@) が指定されていれば、
結......してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。
//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}
@param template 自身のバイナリとしてパックす... -
Array
# pop -> object | nil (6150.0) -
自身の末尾から要素を取り除いてそれを返します。 引数を指定した場合はその個数だけ取り除き、それを配列で返します。
...法として使えます。
@param n 自身から取り除きたい要素の個数を整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(......uby]{
array = [1, [2, 3], 4]
p array.pop # => 4
p array.pop # => [2, 3]
p array # => [1]
p array.pop # => 1
p array.pop # => nil
p array # => []
array = [1, 2, 3]
p array.pop(2) #=> [2, 3]
p array #=> [1]
//}
@see Array#push, Array#shift, Array#unsh... -
Array
# pop(n) -> Array (6150.0) -
自身の末尾から要素を取り除いてそれを返します。 引数を指定した場合はその個数だけ取り除き、それを配列で返します。
...法として使えます。
@param n 自身から取り除きたい要素の個数を整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(......uby]{
array = [1, [2, 3], 4]
p array.pop # => 4
p array.pop # => [2, 3]
p array # => [1]
p array.pop # => 1
p array.pop # => nil
p array # => []
array = [1, 2, 3]
p array.pop(2) #=> [2, 3]
p array #=> [1]
//}
@see Array#push, Array#shift, Array#unsh... -
Array
# zip(*lists) -> [[object]] (6132.0) -
自身と引数に渡した配列の各要素からなる配列の配列を生成して返します。 生成される配列の要素数は self の要素数と同じです。
...です。
ブロック付きで呼び出した場合は、
self と引数に渡した配列の各要素を順番にブロックに渡します。
@param lists 配列を指定します。
配列以外のオブジェクトを指定した場合は to_ary メソッドによ......みます。
@raise TypeError 引数に配列以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
p [1,2,3].zip([4,5,6], [7,8,9])
# => [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
p [1,2].zip([:a,:b,:c], [:A,:B,:C,:D......])
# => a, :A], [2, :b, :B
p [1,2,3,4,5].zip([:a,:b,:c], [:A,:B,:C,:D])
# => [[1, :a, :A], [2, :b, :B],
# [3, :c, :C], [4, nil, :D], [5, nil, nil]]
p [1,2,3].zip([4,5,6], [7,8,9]) { |ary| p ary }
# => [1, 4, 7]
# [2, 5, 8]
# [3, 6, 9]
# nil
//}... -
Array
# zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (6132.0) -
自身と引数に渡した配列の各要素からなる配列の配列を生成して返します。 生成される配列の要素数は self の要素数と同じです。
...です。
ブロック付きで呼び出した場合は、
self と引数に渡した配列の各要素を順番にブロックに渡します。
@param lists 配列を指定します。
配列以外のオブジェクトを指定した場合は to_ary メソッドによ......みます。
@raise TypeError 引数に配列以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
p [1,2,3].zip([4,5,6], [7,8,9])
# => [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
p [1,2].zip([:a,:b,:c], [:A,:B,:C,:D......])
# => a, :A], [2, :b, :B
p [1,2,3,4,5].zip([:a,:b,:c], [:A,:B,:C,:D])
# => [[1, :a, :A], [2, :b, :B],
# [3, :c, :C], [4, nil, :D], [5, nil, nil]]
p [1,2,3].zip([4,5,6], [7,8,9]) { |ary| p ary }
# => [1, 4, 7]
# [2, 5, 8]
# [3, 6, 9]
# nil
//}... -
Array
# compact -> Array (6126.0) -
compact は自身から nil を取り除いた配列を生成して返します。 compact! は自身から破壊的に nil を取り除き、変更が 行われた場合は self を、そうでなければ nil を返します。
...compact は自身から nil を取り除いた配列を生成して返します。
compact! は自身から破壊的に nil を取り除き、変更が
行われた場合は self を、そうでなければ nil を返します。
//emlist[例][ruby]{
ary = [1, nil, 2, nil, 3, nil]
p ary.compact......#=> [1, 2, 3]
p ary #=> [1, nil, 2, nil, 3, nil]
ary.compact!
p ary #=> [1, 2, 3]
p ary.compact! #=> nil
//}... -
Array
# compact! -> self | nil (6126.0) -
compact は自身から nil を取り除いた配列を生成して返します。 compact! は自身から破壊的に nil を取り除き、変更が 行われた場合は self を、そうでなければ nil を返します。
...compact は自身から nil を取り除いた配列を生成して返します。
compact! は自身から破壊的に nil を取り除き、変更が
行われた場合は self を、そうでなければ nil を返します。
//emlist[例][ruby]{
ary = [1, nil, 2, nil, 3, nil]
p ary.compact......#=> [1, 2, 3]
p ary #=> [1, nil, 2, nil, 3, nil]
ary.compact!
p ary #=> [1, 2, 3]
p ary.compact! #=> nil
//}...