833件ヒット
[801-833件を表示]
(0.167秒)
ライブラリ
- ビルトイン (259)
- matrix (24)
- ostruct (10)
-
rake
/ packagetask (60) -
rubygems
/ package / tar _ input (12) - zlib (468)
クラス
- Array (24)
- Data (12)
-
Enumerator
:: Lazy (48) -
Gem
:: Package :: TarInput (12) - OpenStruct (10)
-
Rake
:: PackageTask (60) - Struct (139)
- Vector (24)
-
Zlib
:: GzipFile (96) -
Zlib
:: GzipFile :: Error (24) -
Zlib
:: GzipReader (180) -
Zlib
:: GzipWriter (168)
モジュール
- Enumerable (36)
キーワード
- << (12)
- []= (12)
- close (12)
- comment (12)
- comment= (12)
- crc (12)
- deconstruct (6)
-
deconstruct
_ keys (6) - dig (10)
- each (36)
- each2 (24)
-
each
_ byte (24) -
each
_ line (12) - finish (12)
- flush (12)
- getc (12)
- gets (12)
- input (12)
- inspect (27)
- lazy (12)
- length (12)
- level (12)
- lineno (12)
- mtime (12)
- mtime= (12)
-
need
_ zip (12) -
need
_ zip= (12) -
orig
_ name (12) -
orig
_ name= (12) -
os
_ code (12) - path (12)
- pos (24)
- print (12)
- printf (12)
- putc (12)
- puts (12)
- read (12)
- readchar (12)
- readline (12)
- readpartial (12)
- size (12)
-
take
_ while (24) - tell (24)
-
to
_ a (12) -
to
_ h (25) -
to
_ io (12) -
to
_ s (15) - ungetc (12)
- unused (12)
- values (12)
- write (12)
-
zip
_ command (12) -
zip
_ command= (12) -
zip
_ file (12) -
zipped
_ stream (12)
検索結果
先頭3件
-
Struct
# each {|value| . . . } -> self (3007.0) -
構造体の各メンバに対して繰り返します。
...述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "12......3 Maple, Anytown NC", 12345)
joe.each {|x| puts(x) }
# => Joe Smith
# 123 Maple, Anytown NC
# 12345
//}... -
Vector
# each2(v) {|x , y| . . . } -> self (3007.0) -
ベクトルの各要素と、それに対応するインデックスを持つ引数 v の要素との組に対して (2引数の) ブロックを繰返し評価します。
...ソッドを持つ)オブジェクトです。
Vector も使えます。
ブロックを省略した場合は Enumerator を返します。
@param v 各要素と組を取るためのオブジェクト
@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの......要素の数(次元)が異なっていたときに発生します。
@see Array#zip... -
Enumerable
# lazy -> Enumerator :: Lazy (107.0) -
自身を lazy な Enumerator に変換したものを返します。
...ator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, ta......* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみlazy)
以下はピタゴラス数 (a**2 + b**2 = c**2 を満たす自然数 a, b, c の組) を
列挙するプログラムです。
//emlist[......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).force # takeは...