925件ヒット
[901-925件を表示]
(0.136秒)
ライブラリ
- ビルトイン (308)
-
cgi
/ core (12) -
irb
/ cmd / help (12) -
irb
/ extend-command (12) - json (12)
- logger (24)
- matrix (24)
- mkmf (24)
-
net
/ ftp (12) -
net
/ http (24) -
net
/ imap (72) -
net
/ smtp (72) - openssl (60)
- pathname (12)
- prime (12)
- rake (12)
-
rubygems
/ package / tar _ input (12) -
rubygems
/ remote _ fetcher (12) -
rubygems
/ specification (24) -
rubygems
/ user _ interaction (24) - shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - socket (96)
- tsort (23)
- uri (12)
クラス
- Addrinfo (24)
- Array (12)
-
Encoding
:: Converter (12) -
Gem
:: Package :: TarInput (12) -
Gem
:: RemoteFetcher (12) -
Gem
:: Specification (24) -
Gem
:: StreamUI (12) - IPSocket (12)
-
IRB
:: ExtendCommand :: Help (12) -
JSON
:: State (12) - LocalJumpError (12)
- Logger (24)
- Matrix (24)
-
Net
:: FTP (12) -
Net
:: HTTP (24) -
Net
:: IMAP (60) -
Net
:: IMAP :: Envelope (12) -
Net
:: SMTP (72) - Object (48)
-
OpenSSL
:: X509 :: ExtensionFactory (60) - Pathname (12)
- Prime (12)
-
Rake
:: FileList (12) - Range (34)
-
RubyVM
:: InstructionSequence (10) - Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - Socket (24)
- String (60)
- ThreadGroup (12)
- Time (12)
- TracePoint (48)
- UDPSocket (12)
- UNIXServer (12)
- UNIXSocket (12)
-
URI
:: Generic (12)
モジュール
-
CGI
:: QueryExtension (12) - Enumerable (48)
-
Gem
:: UserInteraction (12) -
IRB
:: ExtendCommandBundle (12) - Kernel (24)
- TSort (23)
キーワード
- % (2)
- accept (12)
- append (12)
-
choose
_ from _ list (24) -
connect
_ from (24) -
convertible
_ int (24) -
create
_ ext _ from _ array (12) -
create
_ ext _ from _ hash (12) -
create
_ ext _ from _ string (12) -
create
_ extension (24) - debug (24)
- disable (24)
- each (24)
-
each
_ strongly _ connected _ component _ from (23) - enable (24)
- enclose (12)
- encode (36)
- encode! (24)
-
enum
_ for (24) -
excluded
_ from _ list? (12) - execute (12)
-
exit
_ value (12) - generate (12)
-
get
_ proxy _ from _ env (12) -
install
_ alias _ method (12) -
int
_ from _ prime _ division (12) -
load
_ gemspec (12) -
loaded
_ from (12) -
loaded
_ from= (12) - mailfrom (12)
-
max
_ by (48) - minor (24)
-
primitive
_ errinfo (12) -
proxy
_ from _ env= (12) -
proxy
_ from _ env? (12) - ready (12)
- recvfrom (36)
-
recvfrom
_ nonblock (24) -
relative
_ path _ from (12) - rename (30)
-
reverse
_ each (4) -
route
_ from (12) - search (12)
-
send
_ mail (12) - sendmail (12)
- size (1)
- sort (12)
- step (3)
- strftime (12)
-
to
_ binary (10) -
to
_ enum (24) - transpose (12)
-
uid
_ search (12) -
uid
_ sort (12)
検索結果
先頭3件
-
Enumerable
# max _ by {|item| . . . } -> object | nil (107.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...は Enumerable#sort と Enumerable#sort_by の違いと同じです。
ブロックを省略した場合は Enumerator を返します。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "horse"]......:max_by>
a.max_by { |x| x.length } # => "albatross"
//}
//emlist[例][ruby]{
a = %w[albatross dog horse]
a.max_by(2) # => #<Enumerator: ["albatross", "dog", "horse"]:max_by(2)>
a.max_by(2) {|x| x.length } # => ["albatross", "horse"]
//}
//emlist[例: enum.max_by(n)は、重......e
# 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_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000... -
Enumerable
# max _ by(n) -> Enumerator (107.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...は Enumerable#sort と Enumerable#sort_by の違いと同じです。
ブロックを省略した場合は Enumerator を返します。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "horse"]......:max_by>
a.max_by { |x| x.length } # => "albatross"
//}
//emlist[例][ruby]{
a = %w[albatross dog horse]
a.max_by(2) # => #<Enumerator: ["albatross", "dog", "horse"]:max_by(2)>
a.max_by(2) {|x| x.length } # => ["albatross", "horse"]
//}
//emlist[例: enum.max_by(n)は、重......e
# 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_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000... -
Enumerable
# max _ by(n) {|item| . . . } -> Array (107.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...は Enumerable#sort と Enumerable#sort_by の違いと同じです。
ブロックを省略した場合は Enumerator を返します。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "horse"]......:max_by>
a.max_by { |x| x.length } # => "albatross"
//}
//emlist[例][ruby]{
a = %w[albatross dog horse]
a.max_by(2) # => #<Enumerator: ["albatross", "dog", "horse"]:max_by(2)>
a.max_by(2) {|x| x.length } # => ["albatross", "horse"]
//}
//emlist[例: enum.max_by(n)は、重......e
# 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_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000...