|
|
last edited 10 years ago by test1 |
1 2 | ||
Editor:
Time: 2007/12/29 20:33:57 GMT-8 |
||
Note: any? and every? |
changed: - 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:: \begin{axiom} any?(i+->(output(i);(i=1)::Boolean),[1,2,3]) \end{axiom} 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) <a href="aggspeed.patch">aggspeed.patch</a> 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. From wyscc Wed Jun 29 02:01:46 -0500 2005 From: wyscc Date: Wed, 29 Jun 2005 02:01:46 -0500 Subject: Have both? Message-ID: <20050629020146-0500@page.axiom-developer.org> 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 From unknown Wed Jun 29 02:49:53 -0500 2005 From: unknown Date: Wed, 29 Jun 2005 02:49:53 -0500 Subject: any? and every? Message-ID: <20050629024953-0500@page.axiom-developer.org> 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.
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.