|
|
last edited 10 years ago by test1 |
1 2 | ||
Editor: test1
Time: 2014/07/28 15:46:31 GMT+0 |
||
Note: |
added:
From test1 Mon Jul 28 15:46:31 +0000 2014
From: test1
Date: Mon, 28 Jul 2014 15:46:31 +0000
Subject:
Message-ID: <20140728154631+0000@axiom-wiki.newsynthesis.org>
Status: fix proposed => closed
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::
any?(i+->(output(i);(i=1)::Boolean),[1, 2, 3])
1
(1) |
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)
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.
William
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.