[#88925] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
4 messages
2018/09/09
[#88927] Re: [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical
— Eric Wong <normalperson@...>
2018/09/09
[email protected] wrote:
[#88926] [Ruby trunk Feature#15095] [PATCH] share VM stack between threads and fibers if identical — ko1@...
Issue #15095 has been updated by ko1 (Koichi Sasada).
3 messages
2018/09/09
[#89218] [Ruby trunk Bug#15130] open-uri hangs on cygwin — duerst@...
SXNzdWUgIzE1MTMwIGhhcyBiZWVuIHVwZGF0ZWQgYnkgZHVlcnN0IChNYXJ0aW4gRMO8cnN0KS4K
5 messages
2018/09/30
[ruby-core:89097] [Ruby trunk Feature#15143] Extend `Enumerable#to_h`
From:
ruby-core@...
Date:
2018-09-20 06:25:26 UTC
List:
ruby-core #89097
Issue #15143 has been updated by marcandre (Marc-Andre Lafortune).
nobu (Nobuyoshi Nakada) wrote:
> Have you changed the mind since #10208?
Or since... #666!
----------------------------------------
Feature #15143: Extend `Enumerable#to_h`
https://bugs.ruby-lang.org/issues/15143#change-74117
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version:
----------------------------------------
Often, we call `Array#to_h` to the result of `Enumerable#map`:
```ruby
(1..5).map{|x| [x, x ** 2]}.to_h
#=> {1=>1, 2=>4, 3=>9, 4=>16, 5=>25}
```
I am thinking of a feature to do this in a single method call.
Currently, `Enumerable#to_h` does not accept a block. I propose that, when `Enumerable#to_h` is called with a block (that has a subarray representing a key-value pair), return a hash that would be returned by applying the block to `map`, and `to_h` to the result:
```ruby
(1..5).to_h{|x| [x, x ** 2]}
#=> {1=>1, 2=>4, 3=>9, 4=>16, 5=>25}
```
Ideally, I request this to be done internally to Ruby without creating an intermediate parent array.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>