Averages/Pythagorean means: Difference between revisions
Content added Content deleted
(Update to work with version 1.4 of Nim. Changed the output to match the actual format.) |
m (→{{header|Phix}}: iff went builtin in 2016!) |
||
Line 2,436: | Line 2,436: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
(note to self: iff should really be a builtin) |
|||
<lang Phix>function arithmetic_mean(sequence s) |
<lang Phix>function arithmetic_mean(sequence s) |
||
return sum(s)/length(s) |
return sum(s)/length(s) |
||
Line 2,457: | Line 2,456: | ||
end function |
end function |
||
function iff(integer condition, object Tval, object Fval) |
|||
if condition then return Tval else return Fval end if |
|||
end function |
|||
constant s = {1,2,3,4,5,6,7,8,9,10} |
constant s = {1,2,3,4,5,6,7,8,9,10} |
||
constant arithmetic = arithmetic_mean(s), |
constant arithmetic = arithmetic_mean(s), |