From: ggmichaelgo@...
Date: 2021-08-02T00:22:45+00:00
Subject: [ruby-core:104742] [Ruby master Feature#18057] Introduce	Array#average

Issue #18057 has been updated by ggmichaelgo (Michael Go).


I have created PR for this feature :)

https://github.com/ruby/ruby/pull/4699


----------------------------------------
Feature #18057: Introduce Array#average
https://bugs.ruby-lang.org/issues/18057#change-93077

* Author: ggmichaelgo (Michael Go)
* Status: Open
* Priority: Normal
----------------------------------------
Introduce Array#average to calculate the average value of an array.

```ruby
array = [1, 2, 3]
array.average # 3

array = [1.5, 2.2, 3.1]
array.average(&:round) # 3.5

array = [-3, -2, -1]
array.average { |e| e.abs } # 3
```



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