[#38392] Enumerable#gather_each — Tanaka Akira <akr@...>

ときに、複数行をまとめて扱いたいことがあります。

47 messages 2009/05/09
[#38394] Re: Enumerable#gather_each — ujihisa <ujihisa@...> 2009/05/09

ujihisaと申します。

[#38400] Re: Enumerable#gather_each — Yukihiro Matsumoto <matz@...> 2009/05/09

まつもと ゆきひろです

[#38399] Re: Enumerable#gather_each — "Akinori MUSHA" <knu@...> 2009/05/09

At Sat, 9 May 2009 15:30:20 +0900,

[#38405] Re: Enumerable#gather_each — Tanaka Akira <akr@...> 2009/05/10

In article <86r5yy2nrg.knu@iDaemons.org>,

[#38417] Re: Enumerable#gather_each — "Akinori MUSHA" <knu@...> 2009/05/10

At Sun, 10 May 2009 10:08:47 +0900,

[#38524] [Bug #1503] -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる — sinnichi eguchi <redmine@...>

Bug #1503: -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる

8 messages 2009/05/22

[ruby-dev:38406] Re: Enumerable#gather_each

From: Tanaka Akira <akr@...>
Date: 2009-05-10 01:28:26 UTC
List: ruby-dev #38406
In article <E1M2t0u-0000Aa-Sd@x61.netlab.jp>,
  Yukihiro Matsumoto <matz@ruby-lang.org> writes:

> 私もそう思います。ただ、Enumerableから「条件を満たす限り連続
> した要素をまとめる」ことをgatherと呼ぶことになんとなく満足で
> きません。gatherという単語からは全体から集めるような印象を受
> けませんか? 私だけの感覚でしょうか。

うぅむ。そんなに悪くはないと思っていたのですが、良い名前があ
れば積極的に受け入れたいと思っています。
(あと、ChangeLog の類のためのメソッド名も)

> だからとって代わりの単語を思いつかないわけですが。

Unix だと uniq なんですが ruby だと uniq も全体だしなぁ。

> だけだと情報があまりにもないので手元のシソーラスでgatherを引
> いたところ、
>
> accumulate, aggregate, amass, assemble, associate, bunch up,
> capture, choose, close with, cluster, collect, concentrate,
> congregate, convence, converge, corral, crowd, cull, draw,
> draw in, flock, forgather, gang up, garner, get together,
> group, hang around, hang out, heap, herd, hoard, huddle, ake
> the scene, marshal, mass, meet, muster, pick, pile up,
> pluck, poke, pour in, punch, rally, reunite, round up, scare
> up, scrape together, show up, stack up, stockpile, swarm,
> throng, unite
>
> とありました。明らかに違うだろうとか、別の意味で使ってるとか
> いうものもありますが、参考までに。

この中だと、accumulate, aggregate, pour, unite あたりはどう
ですかね。

他には each_slice から語を借用して slice もしくは slice_by
はどうでしょうか?

あとは categorize というのも思いつきましたがこれは全体っぽい
なぁ。
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread