Averages/Simple moving average: Difference between revisions

Content added Content deleted
(Added Easylang)
m (→‎{{header|Wren}}: Minor tidy)
Line 4,885: Line 4,885:
{{trans|Go}}
{{trans|Go}}
{{libheader|Wren-fmt}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
<syntaxhighlight lang="wren">import "./fmt" for Fmt


var sma = Fn.new { |period|
var sma = Fn.new { |period|
Line 4,908: Line 4,908:
for (x in [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) {
for (x in [1, 2, 3, 4, 5, 5, 4, 3, 2, 1]) {
Fmt.precision = 3
Fmt.precision = 3
System.print("%(Fmt.f(5, x)) %(Fmt.f(5, sma3.call(x))) %(Fmt.f(5, sma5.call(x)))")
Fmt.print("$5f $5f $5f", x, sma3.call(x), sma5.call(x))
}</syntaxhighlight>
}</syntaxhighlight>