Count in factors: Difference between revisions

m
→‎{{header|Raku}}: Fix-up some Perl6 -> Raku references
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (→‎{{header|Raku}}: Fix-up some Perl6 -> Raku references)
Line 3,199:
19: 19
20: 2 × 2 × 5</pre>
Here we use a <tt>multi</tt> declaration with a constant parameter to match the degenerate case. We use <tt>copy</tt> parameters when we wish to reuse the formal parameter as a mutable variable within the function. (Parameters default to readonly in Perl&nbsp;6Raku.) Note the use of <tt>gather</tt>/<tt>take</tt> as the final statement in the function, which is a common Perl&nbsp;6Raku idiom to set up a coroutine within a function to return a lazy list on demand.
 
Note also the '×' above is not ASCII 'x', but U+00D7 MULTIPLICATION SIGN. Perl&nbsp;6Raku does Unicode natively.
 
Here is a solution inspired from [[Almost_prime#C]]. It doesn't use &is-prime.
10,333

edits