[ruby-core:102995] [Ruby master Feature#17744] Accumulate `Enumerable#tally` results
From:
marcandre-ruby-core@...
Date:
2021-03-24 14:11:55 UTC
List:
ruby-core #102995
Issue #17744 has been updated by marcandre (Marc-Andre Lafortune).
Is there an issue using `merge`?
```ruby
[:a,:b,:c].tally
.merge([:a,:b,:d].tally) { _2 + _3 }
# => {:a=>2, :b=>2, :c=>1, :d=>1}
```
----------------------------------------
Feature #17744: Accumulate `Enumerable#tally` results
https://bugs.ruby-lang.org/issues/17744#change-91058
* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
----------------------------------------
A [feature request] at [DevelopersMeeting20200317Japan]:
> * ko1: want to accumulate `Enumerable#tally` results
>
> ```ruby
> h = {}
> [:a,:b,:c].tally(h)
> [:a,:b,:d].tally(h)
>
> p h #=> {:a=>2, :b=>2, :c=>1, :d=>1}
> ```
>
> * matz: looks good. please create a proposal
[DevelopersMeeting20200317Japan]: https://hackmd.io/nNo0Sb3nRCmQpIwR8XvusA#Other-topics-3
[feature request]: https://github.com/ruby/ruby/pull/4318
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>