ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:43569] [Ruby 1.9 - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
@ 2011-05-20 22:07 ` Shyouhei Urabe
  2011-11-30 21:41 ` [ruby-dev:44910] [ruby-trunk " Yui NARUSE
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: Shyouhei Urabe @ 2011-05-20 22:07 UTC (permalink / raw
  To: ruby developers list


Issue #4147 has been updated by Shyouhei Urabe.


ちょっと、この件が自分にアサインされていてかつ最後がまつもとさんの「取り込んでもいい」で終わってるのを発見したのですが、これってえんどうさんが実装持ってたりします? なければ今から自分が書こうと思いますが。
----------------------------------------
Feature #4147: Array#sample で重みを指定したい
http://redmine.ruby-lang.org/issues/4147

Author: Yoji Ojima
Status: Assigned
Priority: Normal
Assignee: Shyouhei Urabe
Category: 
Target version: 


=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:44910] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
  2011-05-20 22:07 ` [ruby-dev:43569] [Ruby 1.9 - Feature #4147] Array#sample で重みを指定したい Shyouhei Urabe
@ 2011-11-30 21:41 ` Yui NARUSE
  2011-12-01  1:51 ` [ruby-dev:44912] " Shyouhei Urabe
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: Yui NARUSE @ 2011-11-30 21:41 UTC (permalink / raw
  To: ruby developers list


Issue #4147 has been updated by Yui NARUSE.

Target version set to 2.0.0

そろそろ言っちゃっても大丈夫だと思うんですが、これの主たるユースケースってRPGツクールですよね。
http://tkool.jp/
http://d.hatena.ne.jp/ktakaki/20111201/p1

という話を出しつつ、ping
----------------------------------------
Feature #4147: Array#sample で重みを指定したい
http://redmine.ruby-lang.org/issues/4147

Author: Yoji Ojima
Status: Assigned
Priority: Normal
Assignee: Shyouhei Urabe
Category: 
Target version: 2.0.0


=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:44912] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
  2011-05-20 22:07 ` [ruby-dev:43569] [Ruby 1.9 - Feature #4147] Array#sample で重みを指定したい Shyouhei Urabe
  2011-11-30 21:41 ` [ruby-dev:44910] [ruby-trunk " Yui NARUSE
@ 2011-12-01  1:51 ` Shyouhei Urabe
  2012-07-14  4:46 ` [ruby-dev:45950] " akr (Akira Tanaka)
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: Shyouhei Urabe @ 2011-12-01  1:51 UTC (permalink / raw
  To: ruby developers list


Issue #4147 has been updated by Shyouhei Urabe.


まだなんも手をつけてません。卜部にアサインされているのが適切ではないという気もします。
そのうちなんとかしようとは思っていますが、お急ぎでしたらまきとっていただいたほうがよいです。
----------------------------------------
Feature #4147: Array#sample で重みを指定したい
http://redmine.ruby-lang.org/issues/4147

Author: Yoji Ojima
Status: Assigned
Priority: Normal
Assignee: Shyouhei Urabe
Category: 
Target version: 2.0.0


=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:45950] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2011-12-01  1:51 ` [ruby-dev:44912] " Shyouhei Urabe
@ 2012-07-14  4:46 ` akr (Akira Tanaka)
  2012-10-25 14:53 ` [ruby-dev:46271] " yhara (Yutaka HARA)
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: akr (Akira Tanaka) @ 2012-07-14  4:46 UTC (permalink / raw
  To: ruby developers list


Issue #4147 has been updated by akr (Akira Tanaka).


開発ミーティングで話したところ、何を実装すればいいのか仕様がいまひとつはっきりしていないのが
問題で進まないということに一致を見ました。

とりあえず、私は、repeat: オプションとブロックによる重みを実装するのがいいのではないか、と思います。

ここでブロックは与えられた値に対する重みを返すものとします。(累積確率ではありません)

(累積確率よりも単なる重みの方が単純でわかりやすそうというのが、
単にブロックを与えたときに重みと解釈する理由です。
もし累積確率が必要なら、将来的になにかオプション引数で指定するというのはありえます。)
----------------------------------------
Feature #4147: Array#sample で重みを指定したい
https://bugs.ruby-lang.org/issues/4147#change-28017

Author: oj (Yoji Ojima)
Status: Assigned
Priority: Normal
Assignee: shyouhei (Shyouhei Urabe)
Category: 
Target version: 2.0.0


=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:46271] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2012-07-14  4:46 ` [ruby-dev:45950] " akr (Akira Tanaka)
@ 2012-10-25 14:53 ` yhara (Yutaka HARA)
  2014-10-01  3:34 ` [ruby-dev:48587] " mail
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: yhara (Yutaka HARA) @ 2012-10-25 14:53 UTC (permalink / raw
  To: ruby developers list


Issue #4147 has been updated by yhara (Yutaka HARA).

Target version changed from 2.0.0 to next minor


----------------------------------------
Feature #4147: Array#sample で重みを指定したい
https://bugs.ruby-lang.org/issues/4147#change-31575

Author: oj (Yoji Ojima)
Status: Assigned
Priority: Normal
Assignee: shyouhei (Shyouhei Urabe)
Category: 
Target version: next minor


=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:48587] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2012-10-25 14:53 ` [ruby-dev:46271] " yhara (Yutaka HARA)
@ 2014-10-01  3:34 ` mail
  2014-10-01 11:44 ` [ruby-dev:48590] " naruse
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: mail @ 2014-10-01  3:34 UTC (permalink / raw
  To: ruby-dev

Issue #4147 has been updated by gogo tanaka.


こんにちは.

大変昔の話を掘り返すようで恐縮ですが、こちらてパッチを書いたら取り込まれる可能性てございますか?
(もちろんそのパッチ如何によるんでしょうが)

まずはパッチ書いてからにしろという話なら申し訳ございません、

2年前という事で、他の文脈がある事やどなたかが着手されている事を危惧致しました.

----------------------------------------
Feature #4147: Array#sample で重みを指定したい
https://bugs.ruby-lang.org/issues/4147#change-49147

* Author: Yoji Ojima
* Status: Assigned
* Priority: Normal
* Assignee: Shyouhei Urabe
* Category: 
* Target version: next minor
----------------------------------------
=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:48590] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2014-10-01  3:34 ` [ruby-dev:48587] " mail
@ 2014-10-01 11:44 ` naruse
  2014-12-04  1:13 ` [ruby-dev:48761] " shyouhei
  2016-11-21  4:59 ` [ruby-dev:49885] [Ruby trunk Feature#4147][Feedback] " hsbt
  8 siblings, 0 replies; 9+ messages in thread
From: naruse @ 2014-10-01 11:44 UTC (permalink / raw
  To: ruby-dev

Issue #4147 has been updated by Yui NARUSE.

Assignee deleted (Shyouhei Urabe)

gogo tanaka wrote:
> こんにちは.
> 
> 大変昔の話を掘り返すようで恐縮ですが、こちらてパッチを書いたら取り込まれる可能性てございますか?
> (もちろんそのパッチ如何によるんでしょうが)
> 
> まずはパッチ書いてからにしろという話なら申し訳ございません、

この件については、結局どのような仕様を入れるのかというのがポイントな気がしますが、
パッチがあった方が話が早い可能性もあるかな、といったところでしょうか。

> 2年前という事で、他の文脈がある事やどなたかが着手されている事を危惧致しました.

わたしの知る限りでは進捗ないと思います。
うらべさん、あるいは他のどなたか何かありますか?

----------------------------------------
Feature #4147: Array#sample で重みを指定したい
https://bugs.ruby-lang.org/issues/4147#change-49154

* Author: Yoji Ojima
* Status: Assigned
* Priority: Normal
* Assignee: 
* Category: 
* Target version: next minor
----------------------------------------
=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:48761] [ruby-trunk - Feature #4147] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2014-10-01 11:44 ` [ruby-dev:48590] " naruse
@ 2014-12-04  1:13 ` shyouhei
  2016-11-21  4:59 ` [ruby-dev:49885] [Ruby trunk Feature#4147][Feedback] " hsbt
  8 siblings, 0 replies; 9+ messages in thread
From: shyouhei @ 2014-12-04  1:13 UTC (permalink / raw
  To: ruby-dev

Issue #4147 has been updated by Shyouhei Urabe.


Yui NARUSE wrote:
> わたしの知る限りでは進捗ないと思います。
> うらべさん、あるいは他のどなたか何かありますか?

進捗ダメです。

このスレッドのコメント#1でも書きましたが実装があると話が大幅に進むことが多いので実装は大歓迎です。この議論は途中で話が大きくなったり小さくしようとしたりしてだいぶ混乱してしまったので、見通しをよくする意味でもコードがあったほうが助かります。

----------------------------------------
Feature #4147: Array#sample で重みを指定したい
https://bugs.ruby-lang.org/issues/4147#change-50276

* Author: Yoji Ojima
* Status: Assigned
* Priority: Normal
* Assignee: 
* Category: 
* Target version: next minor
----------------------------------------
=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-dev:49885] [Ruby trunk Feature#4147][Feedback] Array#sample で重みを指定したい
       [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2014-12-04  1:13 ` [ruby-dev:48761] " shyouhei
@ 2016-11-21  4:59 ` hsbt
  8 siblings, 0 replies; 9+ messages in thread
From: hsbt @ 2016-11-21  4:59 UTC (permalink / raw
  To: ruby-dev

Issue #4147 has been updated by Hiroshi SHIBATA.

Status changed from Assigned to Feedback

----------------------------------------
Feature #4147: Array#sample で重みを指定したい
https://bugs.ruby-lang.org/issues/4147#change-61599

* Author: Yoji Ojima
* Status: Feedback
* Priority: Normal
* Assignee: 
----------------------------------------
=begin
 Array#sample にブロックを渡したとき、ブロックの戻り値を要素の重みとして使用するのはいかがでしょうか。
 
 下記のサンプルで、"大吉" が "凶" の 1000 倍の確率で選択されるようにしたいです。
 
 omikuji_box = [
   {:name => "大吉", :weight => 1000},
   {:name => "中吉", :weight => 100},
   {:name => "小吉", :weight => 10},
   {:name => "凶",   :weight => 1}
 ]
 omikuji = omikuji_box.sample {|v| v[:weight] }
 puts omikuji[:name]
=end




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-11-21  4:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-4147.20101210220632@ruby-lang.org>
2011-05-20 22:07 ` [ruby-dev:43569] [Ruby 1.9 - Feature #4147] Array#sample で重みを指定したい Shyouhei Urabe
2011-11-30 21:41 ` [ruby-dev:44910] [ruby-trunk " Yui NARUSE
2011-12-01  1:51 ` [ruby-dev:44912] " Shyouhei Urabe
2012-07-14  4:46 ` [ruby-dev:45950] " akr (Akira Tanaka)
2012-10-25 14:53 ` [ruby-dev:46271] " yhara (Yutaka HARA)
2014-10-01  3:34 ` [ruby-dev:48587] " mail
2014-10-01 11:44 ` [ruby-dev:48590] " naruse
2014-12-04  1:13 ` [ruby-dev:48761] " shyouhei
2016-11-21  4:59 ` [ruby-dev:49885] [Ruby trunk Feature#4147][Feedback] " hsbt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).