Pi: Difference between revisions

Content added Content deleted
(added Ol)
m (→‎{{header|Perl 6}}: simplified use of anonymous state variable)
Line 3,355: Line 3,355:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
{{Works with|rakudo|2015-10-23}}
{{Works with|rakudo|2018.10}}
<lang perl6># based on http://www.mathpropress.com/stan/bibliography/spigot.pdf
<lang perl6># based on http://www.mathpropress.com/stan/bibliography/spigot.pdf


Line 3,362: Line 3,362:
$z = safe($z, my $y = next($z)) ??
$z = safe($z, my $y = next($z)) ??
prod($z, take $y) !!
prod($z, take $y) !!
cons($z, @x[(state $)++])
cons($z, @x[$++])
}
}
}
}