24 lines
375 B
Text
24 lines
375 B
Text
implement Command;
|
|
|
|
include "sys.m";
|
|
sys: Sys;
|
|
|
|
include "draw.m";
|
|
|
|
include "sh.m";
|
|
|
|
init(nil: ref Draw->Context, nil: list of string)
|
|
{
|
|
sys = load Sys Sys->PATH;
|
|
|
|
a := array[] of {1.0, 2.0, 500.0, 257.0};
|
|
sys->print("mean of a: %f\n", getmean(a));
|
|
}
|
|
|
|
getmean(a: array of real): real
|
|
{
|
|
n: real = 0.0;
|
|
for (i := 0; i < len a; i++)
|
|
n += a[i];
|
|
return n / (real len a);
|
|
}
|