Raku / old-design-docs

Raku language design documents
https://design.raku.org/
Artistic License 2.0
124 stars 36 forks source link

incorrect example of round priming, scale is no longer named param #29

Closed bbkr closed 11 years ago

bbkr commented 11 years ago

http://perlcabal.org/syn/S32/Numeric.html#Real

Documentation for round() function says that

Functions that round to a particular precision may easily be created by priming:
constant &roundcents ::= &round.assuming(:scale(1/100));

But scale is no longer a named param

 perl6 -e 'Real.^find_method("round").signature.say'
:(Real : $scale = { ... }, Mu *%_)
colomon commented 11 years ago

Example removed:

sub roundcents($x) { round($x, 1/100) }

works just as well as the example was supposed to and is shorter and clearer.