Cumulative standard deviation: Difference between revisions
→{{header|Perl 6}}: style: avoiding parens with the R metaop
m (→{{header|Perl 6}}: no need for parens) |
(→{{header|Perl 6}}: style: avoiding parens with the R metaop) |
||
Line 1,467:
Using a closure:
<lang perl6>sub sd (@a) {
my $mean =
sqrt
}
sub sdaccum {
my @a;
return { push @a, $^x; sd @a; };
};
my &f = sdaccum;
say f $_ for 2, 4, 4, 4, 5, 5, 7, 9;</lang>
|