Continued fraction: Difference between revisions

m
Fix Perl6 -> Raku in comments
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (Fix Perl6 -> Raku in comments)
Line 2,358:
where <math>f_n(x) = a_n + \frac{b_n}{x}</math>
 
Perl6Raku has a builtin composition operator. We can use it with the triangular reduction metaoperator, and evaluate each resulting function at infinity (any value would do actually, but infinite makes it consistent with this particular task).
<lang perl6>sub continued-fraction(@a, @b) {
map { .(Inf) }, [\o] map { @a[$_] + @b[$_] / * }, ^Inf
10,327

edits