Averages/Arithmetic mean: Difference between revisions

Content deleted Content added
Trizen (talk | contribs)
m →‎{{header|Sidef}}: updated code
imported>MaD70
→‎{{header|APL}}: Added proper function definition
Line 329: Line 329:
=={{header|APL}}==
=={{header|APL}}==
{{works with|APL2}}
{{works with|APL2}}
<syntaxhighlight lang="apl"> X←3 1 4 1 5 9
<syntaxhighlight lang="apl">
X←3 1 4 1 5 9
(+/X)÷⍴X
(+/X)÷⍴X
3.833333333</syntaxhighlight>
3.833333333
</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}}==
=={{header|AppleScript}}==