22件ヒット
[1-22件を表示]
(0.141秒)
ライブラリ
- ビルトイン (11)
-
rubygems
/ gem _ path _ searcher (11)
クラス
-
Gem
:: GemPathSearcher (11)
モジュール
- Enumerable (11)
検索結果
先頭2件
-
Gem
:: GemPathSearcher # find _ all(path) -> [Gem :: Specification] (21208.0) -
与えられたパスにマッチする Gem::Specification を全て返します。
...与えられたパスにマッチする Gem::Specification を全て返します。
@see Array#find_all... -
Enumerable
# lazy -> Enumerator :: Lazy (25.0) -
自身を lazy な Enumerator に変換したものを返します。
...、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一......[例][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.take(10).fo......rce # takeはlazyなので、forceが必要です
p pythagorean_triples.first(10) # firstはeagerです
# 100より小さいピタゴラス数を表示する
p pythagorean_triples.take_while { |*, z| z < 100 }.force
//}
@see Enumerator::Lazy...