Skip to content

Instantly share code, notes, and snippets.

Created November 24, 2016 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7bc8161c48b12792d38d011c54f43088 to your computer and use it in GitHub Desktop.
Save anonymous/7bc8161c48b12792d38d011c54f43088 to your computer and use it in GitHub Desktop.
Compute the Euler number upto arbitrary precision in Perl 6
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