5件ヒット
[1-5件を表示]
(0.030秒)
検索結果
先頭5件
-
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (54826.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,... -
Enumerable
# lazy -> Enumerator :: Lazy (54790.0) -
自身を lazy な Enumerator に変換したものを返します。
自身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみl... -
Enumerator
:: Lazy # filter {|item| . . . } -> Enumerator :: Lazy (9526.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 # find _ all {|item| . . . } -> Enumerator :: Lazy (9526.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 # eager -> Enumerator (9190.0) -
自身を遅延評価しない Enumerator に変換して返します。
自身を遅延評価しない Enumerator に変換して返します。
//emlist[例][ruby]{
lazy_enum = (1..).each.lazy
# select が遅延評価されるので終了する
p lazy_enum.class # => Enumerator::Lazy
p lazy_enum.select { |n| n.even? }.first(5)
# => [2, 4, 6, 8, 10]
# select が遅延評価されないので終了しない
enum = lazy_enum.eager
p enum.class # => Enumerator
p enum.s...