Averages/Arithmetic mean: Difference between revisions
Content added Content deleted
(add Haskell example) |
(added Common Lisp example) |
||
Line 33: | Line 33: | ||
3.83333 |
3.83333 |
||
0.00000 |
0.00000 |
||
=={{header|Common Lisp}}== |
|||
This example uses a recursive sum-list function. |
|||
(defun sum-list (list) |
|||
(if (list) |
|||
(+ (car list) (sum-list (cdr list))) |
|||
0)) |
|||
(defun mean (list) |
|||
(/ (sum-list list) (length list))) |
|||
=={{header|J}}== |
=={{header|J}}== |