るりまサーチ

最速Rubyリファレンスマニュアル検索!
191件ヒット [1-100件を表示] (0.172秒)

別のキーワード

  1. _builtin each
  2. _builtin each_line
  3. prime each
  4. each
  5. tsort tsort_each

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Prime::PseudoPrimeGenerator#with_index -> Enumerator (27243.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...価します。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
r
equire 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end...
...# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...

Prime::PseudoPrimeGenerator#with_index {|prime, index| ... } -> self (27243.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...価します。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
r
equire 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end...
...# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...

Matrix#each(which = :all) -> Enumerator (21245.0)

行列の各要素を引数としてブロックを呼び出します。

...:lower 対角成分とそれより下側の部分
* :upper対角成分とそれより上側の部分
* :strict_lower 対角成分の下側
* :strict_upper 対角成分の上側

ブロックを省略した場合、 Enumerator を返します。

//emlist[例][ruby]{
r
equire 'matrix'
Matrix[ [...
...1,2], [3,4] ].each { |e| puts e }
# => prints the numbers 1 to 4
Matrix[ [1,2], [3,4] ].each(:strict_lower).to_a # => [3]
//}

@
param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@
see Matrix#each_with_index, Matrix#map...

Matrix#each(which = :all) {|e| ... } -> self (21145.0)

行列の各要素を引数としてブロックを呼び出します。

...:lower 対角成分とそれより下側の部分
* :upper対角成分とそれより上側の部分
* :strict_lower 対角成分の下側
* :strict_upper 対角成分の上側

ブロックを省略した場合、 Enumerator を返します。

//emlist[例][ruby]{
r
equire 'matrix'
Matrix[ [...
...1,2], [3,4] ].each { |e| puts e }
# => prints the numbers 1 to 4
Matrix[ [1,2], [3,4] ].each(:strict_lower).to_a # => [3]
//}

@
param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@
see Matrix#each_with_index, Matrix#map...

Prime::PseudoPrimeGenerator#each_with_index -> Enumerator (18343.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...価します。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
r
equire 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end...
...# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...

絞り込み条件を変える

Prime::PseudoPrimeGenerator#each_with_index {|prime, index| ... } -> self (18343.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...価します。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
r
equire 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end...
...# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...

Enumerable#each_with_index(*args) -> Enumerator (15383.0)

要素とそのインデックスをブロックに渡して繰り返します。

...り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each
_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@
param args イテレータメソッド (each など) にそのまま...
...][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
r
equire 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@
see En...
...umerator#with_index...

Enumerable#each_with_index(*args) {|item, index| ... } -> self (15383.0)

要素とそのインデックスをブロックに渡して繰り返します。

...り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each
_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@
param args イテレータメソッド (each など) にそのまま...
...][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
r
equire 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@
see En...
...umerator#with_index...

Matrix#each_with_index(which = :all) -> Enumerator (15347.0)

行列の各要素をその位置とともに引数としてブロックを呼び出します。

...とができます。
Matrix#each と同じなのでそちらを参照してください。

ブロックを省略した場合、 Enumerator を返します。

//emlist[例][ruby]{
r
equire 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|
puts "#{e} at #{row}, #{col}"
end
# => 1...
...at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}

@
param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@
see Matrix#each...
<< 1 2 > >>