1246件ヒット
[1201-1246件を表示]
(0.117秒)
クラス
- Array (341)
-
Benchmark
:: Job (12) -
Benchmark
:: Report (36) - Dir (38)
-
Enumerator
:: Lazy (64) -
Net
:: IMAP (12) -
Net
:: IMAP :: MailboxACLItem (24) -
OpenSSL
:: ASN1 :: Constructive (12) -
RSS
:: Maker :: ItemsBase :: ItemBase (48) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Enclosure (24) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Guid (24) -
RSS
:: RDF :: Item (24) -
RSS
:: Rss :: Channel :: Item (48) -
RSS
:: Rss :: Channel :: Item :: Enclosure (36) -
RSS
:: Rss :: Channel :: Item :: Guid (12) - Range (45)
-
Shell
:: CommandProcessor (6)
モジュール
- Enumerable (440)
キーワード
- % (14)
- all? (53)
- any? (62)
- chunk (12)
- collect (48)
- collect! (24)
- description (36)
- description= (36)
- detect (24)
-
drop
_ while (12) - each (36)
-
each
_ child (14) -
each
_ with _ index (24) -
filter
_ map (18) - find (24)
-
find
_ index (36) -
flat
_ map (12) - getacl (12)
- grep (36)
-
grep
_ v (34) - index (36)
- inject (36)
- isPermaLink (24)
- isPermaLink= (12)
- join (6)
-
keep
_ if (24) - list (12)
- map (60)
- map! (24)
-
max
_ by (48) - none? (15)
- one? (15)
- partition (24)
- pubDate (24)
- pubDate= (24)
- reduce (36)
- report (24)
- rights (12)
- rindex (36)
-
sort
_ by (24) - step (31)
- type (24)
- type= (24)
- uniq (24)
- uniq! (24)
- url (12)
- user (12)
検索結果
先頭5件
-
Enumerable
# max _ by -> Enumerator (9.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...違いは Enumerable#sort と Enumerable#sort_by の違いと同じです。
ブロックを省略した場合は Enumerator を返します。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "......は、Enumerable#wsampleを使用します。][ruby]{
module Enumerable
# weighted random sampling.
#
# Pavlos S. Efraimidis, Paul G. Spirakis
# Weighted random sampling with a reservoir
# Information Processing Letters
# Volume 97, Issue 5 (16 March 2006)
def wsample(n)
self.max_b......| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i if h[x] }
#=> *
# ***
# ******
#... -
Enumerable
# max _ by(n) -> Enumerator (9.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...違いは Enumerable#sort と Enumerable#sort_by の違いと同じです。
ブロックを省略した場合は Enumerator を返します。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "......は、Enumerable#wsampleを使用します。][ruby]{
module Enumerable
# weighted random sampling.
#
# Pavlos S. Efraimidis, Paul G. Spirakis
# Weighted random sampling with a reservoir
# Information Processing Letters
# Volume 97, Issue 5 (16 March 2006)
def wsample(n)
self.max_b......| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i if h[x] }
#=> *
# ***
# ******
#... -
Dir
# each -> Enumerator (8.0) -
ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。
...えられなかった場合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。
@raise IOError 既に自身が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}......場合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。
@raise IOError 既に自身が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}
@see Dir#each_child... -
Dir
# each _ child -> Enumerator (8.0) -
ディレクトリの "." と ".." をのぞく各エントリを表す文字列を引数として、 ブロックを評価します。
...合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。
@raise IOError 既に self が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.').each_child{|f|
p f
}
#=> "bar"
# "foo"
//}
@see Dir#each
@see Dir.each_child... -
Range
# %(s) -> Enumerator (8.0) -
範囲内の要素を s おきに繰り返します。
...範囲内の要素を s おきに繰り返します。
@param s 各ステップの大きさを数値で指定します。負の数を指定することもできます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の......Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返します。(例: String の Range)
//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# => "a"
# "c"
# "e"
//}... -
Range
# %(s) -> Enumerator :: ArithmeticSequence (8.0) -
範囲内の要素を s おきに繰り返します。
...範囲内の要素を s おきに繰り返します。
@param s 各ステップの大きさを数値で指定します。負の数を指定することもできます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の......Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返します。(例: String の Range)
//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# => "a"
# "c"
# "e"
//}...