Issue #16781 has been updated by 0x81000000 (/ /).


shan (Shannon Skipper) wrote in #note-2:
> I was surprised to hear this, since I think of "reduce" as most popular.

https://en.wikipedia.org/wiki/Fold_(higher-order_function)
Article 'Reduce_(higher-order_function)' - just redirect to link above.

https://www.quora.com/Is-there-a-difference-between-fold-and-reduce-in-functional-languages

C++ STL - bad reference (an example to follow), std::accumulate 4 times slower than for-loop:
https://habr.com/ru/company/dbtc/blog/498374/#comment_21542236

----------------------------------------
Feature #16781: alias :fold :reduce
https://bugs.ruby-lang.org/issues/16781#change-85671

* Author: 0x81000000 (/ /)
* Status: Open
* Priority: Normal
----------------------------------------
1. Method "collect" has short synonym "map", short synonym of "inject" and "reduce" doesn't exist.
2. Name "fold" is more common/popular than "reduce" or "inject".

In my own code I use:
``` 
module Enumerable
    alias :fold :reduce
end
```
I have no idea how to properly add "fold" in Ruby's stdlib/corelib.




-- 
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>