Comment by Romario77
21 hours ago
avg=: +/ % #
+/ sums the items of the array.
# counts the number of items in the array.
% divides the sum by the number of items.
21 hours ago
avg=: +/ % #
+/ sums the items of the array.
# counts the number of items in the array.
% divides the sum by the number of items.
delightful, ty. How does it handle empty arrays? Throw? Average is zero? Average is infinity?
Average is zero
Further validation for n / 0 = 0 in Elm and Pony and a couple other places! TYSM
I'd call that code obfuscation.
you would not need an explanation.
the thing about tacit programming is that it wouldn't use 'a' in the above. if you wrote average in j without it being tacit, it would probably be more readable to you. the question of how to thread data around without naming it is an interesting one to me.
K et al. can look like that, but this example doesn't require any explanation to someone who has any familiarity.