Averages/Arithmetic mean: Difference between revisions
→{{header|Common Lisp}}: Simpler version using apply
m (→{{header|C++}}) |
(→{{header|Common Lisp}}: Simpler version using apply) |
||
Line 88:
(defun mean (list)
(/ (sum-list list) (length list)))
However the following works as well:
(defun mean (list)
(if list
(/ (apply '+ list) (length list))
0))
=={{header|Forth}}==
|