[#82311] [Ruby trunk Bug#13794] Infinite loop of sched_yield — charlie@...
Issue #13794 has been reported by catphish (Charlie Smurthwaite).
4 messages
2017/08/09
[#82518] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — mame@...
Issue #13618 has been updated by mame (Yusuke Endoh).
5 messages
2017/08/30
[#82552] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2017/08/31
[email protected] wrote:
[#82756] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wrong <normalperson@...>
2017/09/12
Eric Wrong <[email protected]> wrote:
[ruby-core:82264] [Ruby trunk Feature#13784] Add Enumerable#filter as an alias of Enumerable#select
From:
david.n.arnold@...
Date:
2017-08-06 22:23:06 UTC
List:
ruby-core #82264
Issue #13784 has been updated by davidarnold (David Arnold).
> > However the usual industry terms for these are map, filter, and reduce.
>
> I do not know whether these are "industry terms" per se [..]
I suppose there is not a truly objective measure of when something becomes an industry term, but here are 12 more languages that all refer to this function as "filter":
- Closure
- D
- Erlang
- Haskell
- F#
- OCaml
- Standard ML
- Prolog
- Java 8 (streams API)
- PHP (array_* functions)
- R
- Scala
Along with the first three I mentioned (Swift, Python, and ECMAScript), this seems to be somewhat of a preponderance in the industry, no?
> So I am slightly +1 on the suggestion, but the docs should explain why
> .filter is used as alias for .select but not .reject if this is added.
For a rationale, I would say that there are languages which do not call this function "filter", but I believe there are no languages with a function named filter that rejects based on the predicate.
However, I'm not sure why there would be an explanation of this method's name when there are no justifications of any of the other Enumerable names in the docs.
----------------------------------------
Feature #13784: Add Enumerable#filter as an alias of Enumerable#select
https://bugs.ruby-lang.org/issues/13784#change-66047
* Author: davidarnold (David Arnold)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Ruby has a full set of functional tools in the Enumerable module under the "-ect" methods (viz. collect, select, inject). However the usual industry terms for these are map, filter, and reduce.
For example, Swift, Python, and ECMAScript all use the names map, filter, and reduce to describe these methods. Also, this language independent MIT course uses map, filter and reduce: http://web.mit.edu/6.005/www/fa15/classes/25-map-filter-reduce/
Ruby has aliases for map and reduce, but filter is noticeably absent. This feature request is simply to add an alias to Enumerable for filter. This will ease the transition of developers from other languages to Ruby.
Desired behavior:
[:foo, :bar].filter { |x| x == :foo } # => [:foo]
Current behavior:
[:foo, :bar].filter { |x| x == :foo } # NoMethodError: undefined method `filter'
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>