Averages/Simple moving average: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Combine into a single file for ease of testing) |
|||
Line 1,054: | Line 1,054: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA 3. |
ELENA 3.4 : |
||
<lang elena>import system'routines. |
<lang elena>import system'routines. |
||
import system'collections. |
import system'collections. |
||
Line 1,080: | Line 1,080: | ||
if (aCount > thePeriod) |
if (aCount > thePeriod) |
||
[ |
[ |
||
theList |
theList removeAt:0. |
||
aCount := thePeriod |
aCount := thePeriod |
||
]. |
]. |
||
var aSum := theList summarize(Real new |
var aSum := theList summarize(Real new). |
||
^ aSum / aCount |
^ aSum / aCount |
||
Line 1,092: | Line 1,092: | ||
} |
} |
||
program = |
public program = |
||
[ |
[ |
||
var SMA3 := SMA new:3. |
var SMA3 := SMA new:3. |