るりまサーチ

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

別のキーワード

  1. _builtin take_while
  2. _builtin take
  3. tuple take
  4. lazy take_while
  5. array take_while

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

Enumerator::Lazy#take(n) -> Enumerator::Lazy (18142.0)

Enumerable#take と同じですが、配列ではなくEnumerator::Lazy を返します。

...Enumerable#take と同じですが、配列ではなくEnumerator::Lazy を返します。

n が大きな数 (100000とか) の場合に備えて再定義されています。
配列が必要な場合は Enumerable#first を使って下さい。

@param n 要素数を指定します。

@raise Arg...
...umentError n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
1.step.lazy.take(5)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:take(5)>

1.step.lazy.take(5).force
# => [1, 2, 3, 4, 5]
//}

@see Enumerable#take...

Enumerator::Lazy#take_while -> Enumerator::Lazy (6143.0)

Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。

...Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a"...
....."z":cycle>)>:take_while>

1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}

@see Enumerable#take_while...

Enumerator::Lazy#take_while {|item| ... } -> Enumerator::Lazy (6143.0)

Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。

...Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a"...
....."z":cycle>)>:take_while>

1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}

@see Enumerable#take_while...

Enumerator::Lazy#force(*args) -> [object] (13.0)

全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

...要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

Enumerable#to_a のエイリアスです。

//emlist[例][ruby]{
1.step.lazy.take(10).force
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

1.step.lazy.take(10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}...

Enumerator::Lazy#chunk {|elt| ... } -> Enumerator::Lazy (7.0)

Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

...同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true,...

絞り込み条件を変える

Enumerator::Lazy#chunk(initial_state) {|elt, state| ... } -> Enumerator::Lazy (7.0)

Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

...同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true,...

Enumerator::Lazy#collect {|item| ... } -> Enumerator::Lazy (7.0)

Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。

...Enumerator::Lazy を返します。

@raise ArgumentError ブロックを指定しなかった場合に発生します。

//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>

1.step.lazy.collect{ |n| n.succ }.take(10).fo...

Enumerator::Lazy#drop(n) -> Enumerator::Lazy (7.0)

Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。

...Enumerator::Lazy を返します。

@param n 要素数を指定します。

@raise ArgumentError n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
1.step.lazy.drop(3)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop(3)>

1.step.lazy.drop(3).take...

Enumerator::Lazy#drop_while {|item| ... } -> Enumerator::Lazy (7.0)

Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。

...e と同じですが、配列ではなくEnumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>

1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47,...

Enumerator::Lazy#filter {|item| ... } -> Enumerator::Lazy (7.0)

Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。

...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(...

絞り込み条件を変える

<< 1 2 3 > >>