Ingo Blechschmidt writes:
> Hi,
> 
> Luke Palmer wrote:
> >> ...which makes me wonder if it'd be good|cool|whatever to not only
> >> have lazy lists, but also lazy *values*...: :))
> > 
> > Then every expression that referenced lazy values would be lazy in
> > terms
> > of them.  And once you want to print X digits of the lazy answer, you
> > have to go back through the lazy values and caluclate to what
> > precision
> > you need them.
> 
> this is (to a lesser extend) necessary for lazy arrays, too, isn't it?
>   my @nums = (1...);
>   my @foo  = @nums.map:{ ... }; #1
>   my @bar  = @foo .map:{ ... }; #2
>   my @baz  = @bar .map:{ ... }; #3
>   # no map body executed
>   say @nums[0..10];
>   # map bodies of #1, #2, and #3 executed

Right.  Computing how many of those you need is trivial for all of our
provided list operations.  The question is:

    my $pi = lazy_pi;
    my $e  = lazy_e;

    my $epi = $e ** $pi;
    say substr($epi, 0, 400);

How many digits of $pi and $e do we need to accurately compute e**pi to
400 digits?  Our equation, using differential error analysis, is:

    d($epi) == $e**$pi * ($pi/$e * d($e) + log($e) * d($pi))

Now, Perl has to solve that baby to see what values of d($e) and d($pi)
would give an acceptable d($epi).  I don't believe that we've stated
that Mathematica will be embedded in Perl (yet :-).

Luke

Reply via email to