You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
474 B

4 years ago
  1. import _curry1 from "./internal/_curry1.js";
  2. import sum from "./sum.js";
  3. /**
  4. * Returns the mean of the given list of numbers.
  5. *
  6. * @func
  7. * @memberOf R
  8. * @since v0.14.0
  9. * @category Math
  10. * @sig [Number] -> Number
  11. * @param {Array} list
  12. * @return {Number}
  13. * @see R.median
  14. * @example
  15. *
  16. * R.mean([2, 7, 9]); //=> 6
  17. * R.mean([]); //=> NaN
  18. */
  19. var mean =
  20. /*#__PURE__*/
  21. _curry1(function mean(list) {
  22. return sum(list) / list.length;
  23. });
  24. export default mean;