Deming's funnel: Difference between revisions

m
→‎{{header|Perl 6}}: fix bug with anonymous state variable, output tweak
(Added Go)
m (→‎{{header|Perl 6}}: fix bug with anonymous state variable, output tweak)
Line 677:
 
=={{header|Perl 6}}==
{{Works with|rakudoRakudo|2015-11-042018.10}}
<lang perl6>sub mean { @_ R/ [+] @_ }
sub stddev {
Line 722:
 
for @rule {
say "Rule {$(++state$ }):";
my $target = 0i;
my @z = gather for @dz -> $dz {
Line 728:
$target = .($target, $dz)
}
printf "Mean x, y : %7.4f %7.4f\n", mean(@z».re), mean(@z».im);
printf "Std dev x, y : %7.4f %7.4f\n", stddev(@z».re), stddev(@z».im);
}</lang>
{{out}}
<pre>Rule 1:
Mean x, y : 0.0004 0.0702
Std dev x, y : 0.7153 0.6462
Rule 2:
Mean x, y : 0.0009 -0.0103
Std dev x, y : 1.0371 0.8999
Rule 3:
Mean x, y : 0.0439 -0.0063
Std dev x, y : 7.9871 4.7784
Rule 4:
Mean x, y : 3.1341 5.4210
Std dev x, y : 1.5874 3.9304</pre>
 
=={{header|Python}}==
2,392

edits