Averages/Arithmetic mean: Difference between revisions
adding GAP
(→{{header|Tcl}}: remove poor-quality implementation) |
(adding GAP) |
||
Line 445:
We can also make do with the built-in ''List.average'' function
List.average [4;1;7;5;8;4;5;2;1;5;2;5]
=={{header|GAP}}==
<lang gap>Mean := function(v)
local n;
n := Length(v);
if n = 0 then
return 0;
else
return Sum(v)/n;
fi;
end;
Mean([3, 1, 4, 1, 5, 9]);
# 23/6</lang>
=={{header|Groovy}}==
|