axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Patch 3148, was: any?, member?, ...


From: Martin Rubey
Subject: Re: [Axiom-developer] Patch 3148, was: any?, member?, ...
Date: Wed, 23 Jun 2004 17:38:21 +0000

William Sit writes:
 > Martin Rubey wrote:
 > > 
 > > William Sit writes:
 > >  > That was my thoughts when I read your preliminary patch 3148:
 > >  >
 > >  > >      dvdsum(l, x) ==
 > >  > >        x = retract(y := third l)@SE => 0
 > >  > > -      k := retract(d := second l)@K
 > >  > > -      differentiate(h := third rest rest l,x) * eval(f := first l, 
 > > k, h)
 > >  > > -        - differentiate(g := third rest l, x) * eval(f, k, g)
 > >  > > -             + opdsum [differentiate(f, x), d, y, g, h]
 > >  > > +      if member?(x, variables(h := third rest rest l)) or
 > >  > > +         member?(x, variables(g := third rest l)) then
 > >  > > +        dm := dummy
 > >  > > +        kernel(opdiff, [eval(opdsum(l), x::F, dm), dm, x::F])
 > >  > > +      else
 > >  > > +        opdsum [differentiate(first l, x), second l, y, g, h]
 > >  > >
 > >  >
 > >  > Note that g would not have been defined in some cases in the last line 
 > > if
 > >  > the operator OR does not evaluate all its clauses first.
 > > 
 > > Hmm, if the first member? succeeds, g won't be defined but that's no 
 > > problem,
 > > because it won't be used. If the first member? fails, the second member? 
 > > will
 > > be evaluated and g will be defined. Only if both member? fail, the "else" 
 > > part
 > > of the if statement will be evaluated and only in this case g is needed.
 > 
 > Ooops. You are correct.
 > 
 > But the point I was trying to make is that if side-effects in logical clauses
 > may be unevaluated, that would make assessing the correctness of the code 
 > more
 > difficult. (Your explanation above would have to be expanded if there were 
 > more
 > clauses).

You are correct, too...

 > BTW: should dm:=new()$SE be used instead?

well, I think yes, but only if we change all occurrences of dummy to
new()$SE. In the near future (release 1) there should be a pamphlet file that
incorporates all the patches and explains them, too.

Martin





reply via email to

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