るりまサーチ

最速Rubyリファレンスマニュアル検索!
129件ヒット [1-100件を表示] (0.071秒)
トップページ > クエリ:d[x] > クエリ:inject[x]

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. rsa d=
  4. rsa d
  5. openssl d

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

Enumerable#inject(init = self.first) {|result, item| ... } -> object (18133.0)

リストのたたみこみ演算を行います。

...ます。

//emlist[例][ruby]{
# 合計を計算する。
p [2, 3, 4, 5].inject {|result, item| result + item } #=> 14

# 自乗和を計算する。初期値をセットする必要がある。
p [2, 3, 4, 5].inject(0) {|result, item| result + item**2 } #=> 54
//}

この式は以下のよ...
...うに書いても同じ結果が得られます。

//emlist[例][ruby]{
result = 0
[1, 2, 3, 4, 5].each {|v| result += v }
p result # => 15

p [1, 2, 3, 4, 5].inject(:+) #=> 15
p ["b", "c", "d"].inject("abbccddde", :squeeze) #=> "abcde"
//}...

Enumerable#inject(init, sym) -> object (18133.0)

リストのたたみこみ演算を行います。

...ます。

//emlist[例][ruby]{
# 合計を計算する。
p [2, 3, 4, 5].inject {|result, item| result + item } #=> 14

# 自乗和を計算する。初期値をセットする必要がある。
p [2, 3, 4, 5].inject(0) {|result, item| result + item**2 } #=> 54
//}

この式は以下のよ...
...うに書いても同じ結果が得られます。

//emlist[例][ruby]{
result = 0
[1, 2, 3, 4, 5].each {|v| result += v }
p result # => 15

p [1, 2, 3, 4, 5].inject(:+) #=> 15
p ["b", "c", "d"].inject("abbccddde", :squeeze) #=> "abcde"
//}...

Enumerable#inject(sym) -> object (18133.0)

リストのたたみこみ演算を行います。

...ます。

//emlist[例][ruby]{
# 合計を計算する。
p [2, 3, 4, 5].inject {|result, item| result + item } #=> 14

# 自乗和を計算する。初期値をセットする必要がある。
p [2, 3, 4, 5].inject(0) {|result, item| result + item**2 } #=> 54
//}

この式は以下のよ...
...うに書いても同じ結果が得られます。

//emlist[例][ruby]{
result = 0
[1, 2, 3, 4, 5].each {|v| result += v }
p result # => 15

p [1, 2, 3, 4, 5].inject(:+) #=> 15
p ["b", "c", "d"].inject("abbccddde", :squeeze) #=> "abcde"
//}...

Enumerable#reduce(init = self.first) {|result, item| ... } -> object (6133.0)

リストのたたみこみ演算を行います。

...ます。

//emlist[例][ruby]{
# 合計を計算する。
p [2, 3, 4, 5].inject {|result, item| result + item } #=> 14

# 自乗和を計算する。初期値をセットする必要がある。
p [2, 3, 4, 5].inject(0) {|result, item| result + item**2 } #=> 54
//}

この式は以下のよ...
...うに書いても同じ結果が得られます。

//emlist[例][ruby]{
result = 0
[1, 2, 3, 4, 5].each {|v| result += v }
p result # => 15

p [1, 2, 3, 4, 5].inject(:+) #=> 15
p ["b", "c", "d"].inject("abbccddde", :squeeze) #=> "abcde"
//}...

Enumerable#reduce(init, sym) -> object (6133.0)

リストのたたみこみ演算を行います。

...ます。

//emlist[例][ruby]{
# 合計を計算する。
p [2, 3, 4, 5].inject {|result, item| result + item } #=> 14

# 自乗和を計算する。初期値をセットする必要がある。
p [2, 3, 4, 5].inject(0) {|result, item| result + item**2 } #=> 54
//}

この式は以下のよ...
...うに書いても同じ結果が得られます。

//emlist[例][ruby]{
result = 0
[1, 2, 3, 4, 5].each {|v| result += v }
p result # => 15

p [1, 2, 3, 4, 5].inject(:+) #=> 15
p ["b", "c", "d"].inject("abbccddde", :squeeze) #=> "abcde"
//}...

絞り込み条件を変える

Enumerable#reduce(sym) -> object (6133.0)

リストのたたみこみ演算を行います。

...ます。

//emlist[例][ruby]{
# 合計を計算する。
p [2, 3, 4, 5].inject {|result, item| result + item } #=> 14

# 自乗和を計算する。初期値をセットする必要がある。
p [2, 3, 4, 5].inject(0) {|result, item| result + item**2 } #=> 54
//}

この式は以下のよ...
...うに書いても同じ結果が得られます。

//emlist[例][ruby]{
result = 0
[1, 2, 3, 4, 5].each {|v| result += v }
p result # => 15

p [1, 2, 3, 4, 5].inject(:+) #=> 15
p ["b", "c", "d"].inject("abbccddde", :squeeze) #=> "abcde"
//}...

Array#pack(template) -> String (66.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...g endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned short
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{
s: int16_t
S: uint16_t
l: int32_t...
...""
[82, 117, 98, 121].each {|c| s << c}
s # => "Ruby"

[82, 117, 98, 121].collect {|c| sprintf "%c", c}.join # => "Ruby"

[82, 117, 98, 121].inject("") {|s, c| s << c} # => "Ruby"
//}

: 文字列を数値(文字コード)の配列に変換する例
//emlist[][ruby]{
"Ruby".unpack('C*')...

Array#pack(template, buffer: String.new) -> String (66.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...g endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned short
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{
s: int16_t
S: uint16_t
l: int32_t...
...""
[82, 117, 98, 121].each {|c| s << c}
s # => "Ruby"

[82, 117, 98, 121].collect {|c| sprintf "%c", c}.join # => "Ruby"

[82, 117, 98, 121].inject("") {|s, c| s << c} # => "Ruby"
//}

: 文字列を数値(文字コード)の配列に変換する例
//emlist[][ruby]{
"Ruby".unpack('C*')...

String#unpack(template) -> Array (66.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...g endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned short
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{
s: int16_t
S: uint16_t
l: int32_t...
...""
[82, 117, 98, 121].each {|c| s << c}
s # => "Ruby"

[82, 117, 98, 121].collect {|c| sprintf "%c", c}.join # => "Ruby"

[82, 117, 98, 121].inject("") {|s, c| s << c} # => "Ruby"
//}

: 文字列を数値(文字コード)の配列に変換する例
//emlist[][ruby]{
"Ruby".unpack('C*')...
<< 1 2 > >>