Averages/Arithmetic mean: Difference between revisions

→‎{{header|APL}}: Added proper function definition
m (→‎{{header|Sidef}}: updated code)
imported>MaD70
(→‎{{header|APL}}: Added proper function definition)
Line 329:
=={{header|APL}}==
{{works with|APL2}}
<syntaxhighlight lang="apl"> X←3 1 4 1 5 9
X←3 1 4 1 5 9
(+/X)÷⍴X
3.833333333</syntaxhighlight>
</syntaxhighlight>
 
{{works with|Dyalog APL}}
A proper function definition:
<syntaxhighlight lang="apl">
Avg←{(+⌿⍵)÷≢⍵}
Avg 1 2 3 4 5 6
3.5
</syntaxhighlight>
 
Using [[tacit programming]]:
<syntaxhighlight lang="apl">
Avg← +⌿÷≢
Avg 1 2 3 4 5 6
3.5
</syntaxhighlight>
'''N.B.:''' the symbol for [https://aplwiki.com/wiki/Tally Tally (≢)] doesn't display correctly at the moment.
 
=={{header|AppleScript}}==
Anonymous user