axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Lazy re-evaluation (was: More AxiomUI)


From: William Sit
Subject: Re: [Axiom-developer] Lazy re-evaluation (was: More AxiomUI)
Date: Thu, 23 Jun 2005 05:56:50 -0400


"Page, Bill" wrote:

> Of course in this very simple example there is no significant
> difference. But if line (3) happened to involve a very lengthy
> calculation, it would be greatly to our advantage that we can
> simply restore the value that is consistent with what is now
> displayed on the page.
> 

I think LRE is a double edge sword. Consider the example below:

(1) n:=2
(2) x:=f(n)
(3) n:=n+1
(4) y:=g(n)


Suppose f is a very expensive (or even outside the ability of the machine)
function to compute if n is 3, say f(n) = 2^(2^(2^(2^n))), and g is a simple
one, like n^2. Suppose further that I want to keep the value of x at f(2). If I
change the first line to n:=3 what would LRE do? It would re-execute line (2) to
evaluate the expensive f(3) and probably never get to reevaluating (3) and (4).
If I were able to manually select the sequence of recomputation, I would be able
to just re-executive (1), (3) and (4).

Of course in this simple example, I may be able to rearrange the code to get
around LRE recomputing x (like inserting n:=2 after (2) and editing that
instead), but why should I?


> As Bob McElrath stated earlier, in a long and complex calculation,
> it would be much better to be able to depend on the fact that the
> machine is always going to do just the minimum that is required
> in order to ensure that the state of Axiom is consistent with the
> sequence of commands on the page. I have also sometimes found
> myself in the situation that Bob describes where I seem to be
> unable to reproduce a desired result displayed in my worksheet
> simply because I have forgotten one critical link in the chain of
> dependencies while making some side-attempt to solve some other
> apparently unrelated problem. Of course one soon becomes suspicious
> of this possibility and probably hits the !!! button to re-execute
> the whole worksheet and then goes to lunch while the machine
> tediously retraces all of it's steps... it seems a pity that we
> have to waste machine resources on something like this.
> 
> Regards.
> Bill Page.

I certainly have such experience as well. But I have also experienced the other
side: I have selected to re-evaluate the entire sequence only to notice that
there is one very long computation that I do not want to re-evaulate because I
had changed the size of the computation (like n:=3 above) and the only recourse
I have is to cancel the evaluation and then select only the ones I want to do.
Occasionally, the computation cannot be stopped and such attempt even cause the
program to crash (of course without saving first).

So I think if LRE is available, it should not be automatic and the control to
use it or not should remain the choice of the user. Neither is consistency a
must.

William




reply via email to

[Prev in Thread] Current Thread [Next in Thread]