144件ヒット
[101-144件を表示]
(0.086秒)
クラス
- Array (24)
-
Enumerator
:: Lazy (48) - Object (24)
- PP (12)
モジュール
- Enumerable (36)
キーワード
- lazy (12)
- pp (12)
-
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
take
_ while (24) - zip (24)
検索結果
先頭4件
-
Enumerator
:: Lazy # zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (25.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
...uby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}
@see Enumerable#zip... -
Object
# pretty _ print(pp) -> () (19.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...ドを定義しています。
@param pp PP オブジェクトです。
//emlist[][ruby]{
require 'pp'
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#te......ソッドを定義しています。
@param pp PP オブジェクトです。
//emlist[][ruby]{
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, Pret... -
Enumerable
# lazy -> Enumerator :: Lazy (13.0) -
自身を lazy な Enumerator に変換したものを返します。
...nd_all
* reject
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみlazy)
以下はピタゴラス数 (a**2 + b**2 = c**2 を満たす自然数 a,......数を表示する
p pythagorean_triples.take(10).force # takeはlazyなので、forceが必要です
p pythagorean_triples.first(10) # firstはeagerです
# 100より小さいピタゴラス数を表示する
p pythagorean_triples.take_while { |*, z| z < 100 }.force
//}
@see Enumerator::Lazy... -
PP
# pp(obj) -> () (13.0) -
指定されたオブジェクト obj を Object#pretty_print を使って自身のバッファに追加します。
...す。
obj がすでに、現在のノードの親において出力されていた場合には、
参照のループが存在しているので、Object#pretty_print の代わりに
Object#pretty_print_cycle が使われます。
@param obj 表示したいオブジェクトを指定します。...