March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import std.stdio, std.algorithm, std.range;
|
||||
|
||||
real mean(Range)(Range r) pure nothrow {
|
||||
return reduce!q{a + b}(0.0L, r) / max(1.0L, r.count);
|
||||
return r.sum / max(1.0L, r.count);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
num mean(List<num> l) => l.reduce((num p, num n) => p + n) / l.length;
|
||||
|
||||
void main(){
|
||||
print(mean([1,2,3,4,5,6,7]));
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
mean[x] := length[x] > 0 ? sum[x] / length[x] : undef
|
||||
|
|
@ -1 +1,2 @@
|
|||
load("descriptive");
|
||||
mean([2, 7, 11, 17]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue