[#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:61332] [ruby-trunk - Feature #9602] [Feedback] Logic with `Enumerable#grep`

From: matz@...
Date: 2014-03-06 15:20:39 UTC
List: ruby-core #61332
Issue #9602 has been updated by Yukihiro Matsumoto.

Status changed from Open to Feedback
Assignee set to Yukihiro Matsumoto

I am afraid that proposed behavior is too far away from the original 'grep'.
We should use #select for more complex filtering.

Any opinion?

Matz.


----------------------------------------
Feature #9602: Logic with `Enumerable#grep`
https://bugs.ruby-lang.org/issues/9602#change-45656

* Author: Tsuyoshi Sawada
* Status: Feedback
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: 
* Target version: 
----------------------------------------
`Enumerable#grep` is useful to filter things:

    [nil, {}, [], 1, :foo, "foo"].grep(String)
    # => ["foo"]

1. Often, the condition cannot be expressed as a single object on which `===` is applied, but as a disjunction over `===` applied to multiple objects. I would like `Enumerable#grep` to take arbitrary number of arguments, and when they are more than one, a logical disjunction applies, just as when there are multiple comma-separated objects after `when` in `case` condition:

        [nil, {}, [], 1, :foo, "foo"].grep(String, Symbol, Array)
        # => [[], :foo, "foo"]

2. Also, it often happens that I want the negation of grep. Perhaps, `Enumerable#grepv` (`grepv` comes from `grep -v`) can be implemented as negation of `Enumerable#grep`, i.e., select elements for which `===` returns false on any of the arguments:

        [nil, {}, [], 1, :foo, "foo"].grepv(String, Symbol, Array)
        # => [nil, {}, 1]



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

In This Thread

Prev Next