41件ヒット
[1-41件を表示]
(0.035秒)
別のキーワード
種類
- インスタンスメソッド (36)
- 文書 (5)
ライブラリ
- ビルトイン (36)
モジュール
- Enumerable (36)
キーワード
-
NEWS for Ruby 3
. 0 . 0 (5) - lazy (12)
検索結果
先頭4件
-
Enumerable
# drop _ while -> Enumerator (21108.0) -
ブロックを評価して最初に偽となった要素の手前の要素まで捨て、 残りの要素を配列として返します。
...価して最初に偽となった要素の手前の要素まで捨て、
残りの要素を配列として返します。
ブロックを指定しなかった場合は、Enumerator を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
//}... -
Enumerable
# drop _ while {|element| . . . } -> Array (21108.0) -
ブロックを評価して最初に偽となった要素の手前の要素まで捨て、 残りの要素を配列として返します。
...価して最初に偽となった要素の手前の要素まで捨て、
残りの要素を配列として返します。
ブロックを指定しなかった場合は、Enumerator を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
//}... -
NEWS for Ruby 3
. 0 . 0 (3036.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......n Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{......-backtrace-limit` option limits the maximum length of a backtrace.
8661
== Core classes updates
Outstanding ones only.
* Array
* The following methods now return Array instances instead of subclass instances when called on subclass instances: 6087
* Array#drop
* Array#drop_while... -
Enumerable
# lazy -> Enumerator :: Lazy (3018.0) -
自身を lazy な Enumerator に変換したものを返します。
...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個のピタゴラス数を表示す...