66件ヒット
[1-66件を表示]
(0.157秒)
ライブラリ
- ビルトイン (66)
クラス
-
Enumerator
:: Lazy (44)
モジュール
- Enumerable (11)
- GC (11)
キーワード
-
collect
_ concat (11) -
flat
_ map (11) -
garbage
_ collect (11) - map (11)
検索結果
先頭5件
-
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (27350.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
...Enumerable#map と同じですが、配列ではなく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).force
# => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//}
@see Enumerable#map... -
Enumerable
# lazy -> Enumerator :: Lazy (24461.0) -
自身を lazy な Enumerator に変換したものを返します。
...身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reje......ct
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみlazy)
以下はピタゴラス数 (a**2 + b**2 = c**2 を満たす自然数 a, b, c の組)......//emlist[例][ruby]{
def pythagorean_triples
(1..Float::INFINITY).lazy.flat_map {|z|
(1..z).flat_map {|x|
(x..z).select {|y|
x**2 + y**2 == z**2
}.map {|y|
[x, y, z]
}
}
}
end
# 最初の10個のピタゴラス数を表示する
p pythagorean_triples.ta... -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (15344.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
...結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の......Lazy) とき
それ以外のときは、x は分解されず、そのままの値として使われます。
//emlist[][ruby]{
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:b=>2}]
//}
@raise ArgumentError ブロックを指定しなかった場合に発生します。
@see Enumerabl......e#flat_map... -
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (12344.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
...結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の......Lazy) とき
それ以外のときは、x は分解されず、そのままの値として使われます。
//emlist[][ruby]{
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:b=>2}]
//}
@raise ArgumentError ブロックを指定しなかった場合に発生します。
@see Enumerabl......e#flat_map... -
GC
# garbage _ collect(full _ mark: true , immediate _ sweep: true) -> nil (12320.0) -
ガーベージコレクトを開始します。
...ます。
GC.start や ObjectSpace.#garbage_collect と同じ働きをします。
GC.disable により GC が禁止されている場合は何もしません。
nil を返します。
@param full_mark マイナー GC を動作させる場合は false を、そうでない場
合......は true を指定します。
@param immediate_sweep sweep を遅らせる(Lazy Sweep を行う)場合は false
を、そうでない場合は true を指定します。
注意: これらのキーワード引数は Ruby の実装やバージョンによって異なりま......将来のバージョンとの互換性も保証されません。また、Ruby の実装がサポー
トしていない場合はキーワード引数を指定しても無視される可能性があります。
//emlist[例][ruby]{
include GC
GC.count # => 3
garbage_collect
GC.count # => 4
//}......C.start や ObjectSpace.#garbage_collect と同じ働きをします。
GC.disable により GC が禁止されている場合でもガベージコレクトを開始します。
nil を返します。
@param full_mark マイナー GC を動作させる場合は false を、そうでない場......合は true を指定します。
@param immediate_sweep sweep を遅らせる(Lazy Sweep を行う)場合は false
を、そうでない場合は true を指定します。
注意: これらのキーワード引数は Ruby の実装やバージョンによって... -
Enumerator
:: Lazy # map {|item| . . . } -> Enumerator :: Lazy (9250.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
...Enumerable#map と同じですが、配列ではなく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).force
# => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//}
@see Enumerable#map...