Skip to content

Commit

Permalink
Add Rosetta Code 'Averages/RArithmetic mean' task (from Daniel Shindler)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrthomas committed Jan 5, 2025
1 parent c64fbcf commit 7326075
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions rosettacode/Averages-Arithmetic mean.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
8 changes: 8 additions & 0 deletions rosettacode/Averages-Arithmetic mean.ursa
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let mean = fn(l) {
var tot = 0
for i in l.iter() {
tot := tot + i
}
return tot / l.len()
}
print(mean([10, 30, 50, 5, 5]))
1 change: 1 addition & 0 deletions src/ursa/examples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
// Rosetta code examples
['Accumulator factory', 'rosettacode/Accumulator factory'],
['Ackermann function', 'rosettacode/Ackermann function'],
['Averages/Arithmetic mean', 'rosettacode/Averages-Arithmetic mean'],
['Averages/Root mean square', 'rosettacode/Averages-Root mean square'],
// This program has an unbound variable
// ['Conditional structures', 'rosettacode/Conditional structures'],
Expand Down

0 comments on commit 7326075

Please sign in to comment.