329件ヒット
[301-329件を表示]
(0.195秒)
種類
- インスタンスメソッド (241)
- 特異メソッド (82)
- クラス (6)
ライブラリ
- ビルトイン (329)
クラス
- Array (56)
-
Enumerator
:: Lazy (39) - Hash (70)
- Set (6)
- Struct (28)
モジュール
- Enumerable (54)
オブジェクト
- ENV (70)
検索結果
先頭5件
-
Enumerator
:: Lazy # find _ all {|item| . . . } -> Enumerator :: Lazy (11001.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (11001.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Set
# select! {|element| . . . } -> self | nil (11001.0) -
各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。
各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。
@return 変更があった場合は self を、変更がなかった場合は nil を返します。 -
Enumerator
:: Lazy . new(obj , size=nil) {|yielder , *values| . . . } -> Enumerator :: Lazy (8024.0) -
Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を 指定できます。
...d される値を
指定できます。
//emlist[Enumerable#filter_map と、その遅延評価版を定義する例][ruby]{
module Enumerable
def filter_map(&block)
map(&block).compact
end
end
class Enumerator::Lazy
def filter_map
Lazy.new(self) do |yielder, *values|
result =......yield *values
yielder << result if result
end
end
end
1.step.lazy.filter_map{|i| i*i if i.even?}.first(5)
# => [4, 16, 36, 64, 100]
//}
@raise ArgumentError 引数を指定しなかった場合、ブロックを指定しなかった場合に発生します。
@see Enumerator.new... -
Enumerator
:: Lazy (8006.0) -
map や select などのメソッドの遅延評価版を提供するためのクラス。
...行う
(つまり、配列ではなく Enumerator を返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* filter_map
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_...