[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92526] [Ruby trunk Feature#11076] Enumerable method count_by
From:
jonathan@...
Date:
2019-05-02 14:41:13 UTC
List:
ruby-core #92526
Issue #11076 has been updated by jonathanhefner (Jonathan Hefner).
> "map + select" is much more frequent, but it is not introduced yet
I think it would also be nice if `filter_map` was added. However, a specific justification for adding `tally_by` is to avoid an extra array allocation. `filter_map` can already be expressed as `map { ... }.compact!` to avoid allocating an extra array. But there is no way to avoid an extra allocation with `map { ... }.tally`.
----------------------------------------
Feature #11076: Enumerable method count_by
https://bugs.ruby-lang.org/issues/11076#change-77888
* Author: haraldb (Harald Btiger)
* Status: Closed
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version:
----------------------------------------
I very often use `Hash[array.group_by{|x|x}.map{|x,y|[x,y.size]}]`.
Would be nice with to have a method called `count_by`:
~~~ruby
array = ['aa', 'aA', 'bb', 'cc']
p array.count_by(&:downcase) #=> {'aa'=>2,'bb'=>1,'cc'=>1}
~~~
--
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>