Created
November 24, 2016 05:01
-
-
Save anonymous/7bc8161c48b12792d38d011c54f43088 to your computer and use it in GitHub Desktop.
Compute the Euler number upto arbitrary precision in Perl 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub postfix:<!>($n) { [*] 1..$n } | |
my &f = -> $n { 1 / ($n)! } | |
my $idx := 0 ... *; | |
my $seq1 = map { f($_) } $idx; # I want $seq1 to be lazy | |
my $seq2 = <cumulative summation of $seq1 computed lazily - HOW? > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment