[#75225] [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7) — k@...
Issue #12324 has been reported by Kazuki Yamaguchi.
6 messages
2016/04/27
[#78693] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Eric Wong <normalperson@...>
2016/12/17
k@rhe.jp wrote:
[#78701] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Kazuki Yamaguchi <k@...>
2016/12/17
On Sat, Dec 17, 2016 at 01:31:12AM +0000, Eric Wong wrote:
[#78702] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Eric Wong <normalperson@...>
2016/12/17
Kazuki Yamaguchi <k@rhe.jp> wrote:
[ruby-core:75185] [Ruby trunk Feature#12318] Returning the evaluated value of a block
From:
nobu@...
Date:
2016-04-26 02:27:31 UTC
List:
ruby-core #75185
Issue #12318 has been updated by Nobuyoshi Nakada.
It doesn't seem generic enough to be defined in `Enumerator`.
The receiver enumerator may return different object than its elements nor the results of the given block, whereas that `and_return` has to manage the association of them.
Why not simpler:
```ruby
[7, 8, 9].map{|e| e % 3}.max
# => 2
```
```ruby
["foo", "bar", "baz"].find{|e| break e if e = e[/(.)\1/]}
# => "oo"
```
or
```ruby
["foo", "bar", "baz"].grep(/(.)\1/) {break $&}
# => "oo"
```
----------------------------------------
Feature #12318: Returning the evaluated value of a block
https://bugs.ruby-lang.org/issues/12318#change-58316
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
I often achieve an element using an iterator with a block, and then apply the same/a similar block to the element I get. Examples are:
~~~ruby
[7, 8, 9]
.max_by{|e| e % 3}
.tap{|e| break e % 3}
# => 2
["foo", "bar", "baz"]
.find{|e| e[/(.)\1/]}
.tap{|e| break e[/(.)\1/]}
# => "oo"
~~~
I would like a method on `Enumerator` that returns the result of the block rather than the original element in the iterator. Not sure about the name, but if I call it `and_return` temporary, it should look like:
~~~ruby
[7, 8, 9]
.max_by.and_return{|e| e % 3}
# => 2
["foo", "bar", "baz"]
.find.and_return{|e| e[/(.)\1/]}
# => "oo"
~~~
--
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>