RosettaCodeData/Task/Averages-Arithmetic-mean/Perl-6/averages-arithmetic-mean.pl6
2015-11-18 06:14:39 +00:00

2 lines
140 B
Raku

multi mean([]){ Failure.new('mean on empty list is not defined') }; # Failure-objects are lazy exceptions
multi mean (@a) { ([+] @a) / @a }