login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Submitted by : (unknown) at: 2007-11-17T22:04:14-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

any? and every? should exit when the result is clear.

As discussed in the thread starting with http://lists.gnu.org/archive/html/axiom-developer/2004-06/msg00196.html I believe that the following behaviour of any? and every? is bad, because things are computed unnecessarily::

axiom
any?(i+->(output(i);(i=1)::Boolean),[1,2,3])
1

\label{eq1} \mbox{\rm true} (1)
Type: Boolean

The attached patch fixes this for HOAGG and CLAGG in aggcat.spad. This makes axioms behaviour more consistent also: in TBAGG, A1AGG, ARR2CAT, LZSTAGG the functions are done as in the patch, in TREE a mixed behaviour is exhibited (and should be fixed)

aggspeed.patch

Martin

Bill wrote:

Can we be sure that functions applied during evaluating any? and every? are not being executed for their side-effects? I worry that changing the semantics here could have unexpected effects in other places in Axiom where any? and every? are used.

Martin replied:

In fact, I included the comment regarding TREE only to document that if there would be code that depends on the "evaluate all" code, it wouldn't work with TREE anyway, so it would be broken already. Bottom line: no danger.

Bill replied:

I am not convinced. I think this needs more analysis, i.e. look at each case were any? and every? are actually used or else we have to be prepared to do a lot of testing.

Martin replied:

I did some analysis and I'm quite sure that no code will be broken. However, this is a patch I won't push, since it won't produce incorrect results.

How about just adding a more efficient any? and every? (don't overload them though) in an auxilliary package? Nothing will be broken and you can have both at your finger tips. I believe this is philosophy behind many of the post-facto packages.

William

any? and every? --unknown, Wed, 29 Jun 2005 02:49:53 -0500 reply
The better way is to have a general policy for the axiom langage, not to have more and more packages. It must be possible to explain axiom with very few words, and I find it's better to say that axiom is a lazy language, so I believe that every? and any? must change.

Status: fix proposed => closed




  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: