[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61462] [ruby-trunk - Feature #9635] [Open] Map a hash directly to a hash

From: lolmaus@...
Date: 2014-03-13 12:42:20 UTC
List: ruby-core #61462
Issue #9635 has been reported by Andrey Mikhaylov.

----------------------------------------
Feature #9635: Map a hash directly to a hash
https://bugs.ruby-lang.org/issues/9635

* Author: Andrey Mikhaylov
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
There should be a way to directly map a hash to a hash.

The current way to do it is not very graceful:

~~~
{foo: 'foo', bar: 'bar'}.map { |key, value| [key.upcase, value.reverse] }.to_h     # => { :FOO => 'oof', :BAR => 'rab' }
~~~

I think there should be a simpler and more natural way to do that. Something like this:

~~~
{foo: 'foo', bar: 'bar'}.hashy_map { |key, value| key.upcase => value.reverse }    # => { :FOO => 'oof', :BAR => 'rab' }
~~~



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

In This Thread

Prev Next