axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] Bug in parallel iteration


From: Martin Rubey
Subject: [Axiom-developer] Bug in parallel iteration
Date: 25 Nov 2007 11:28:11 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Dear all,

I just found a *very* annoying bug in axiom's handling of parallel iteration:

-------------------------------------------------------------------------------
(1) -> [[i,j] for i in 1..10 | odd? i for j in 1..10]

   (1) [[1,1],[3,3],[5,5],[7,7],[9,9]]
-------------------------------------------------------------------------------

(the result is the same in SPAD, i.e., compiled)

instead of

-------------------------------------------------------------------------------
%1 >> #include "aldor"
                                           Comp: 170 msec, Interp: 50 msec
%2 >> #include "aldorinterp"
                                           Comp: 80 msec, Interp: 0 msec
%3 >> import from Integer, List Integer, List List Integer
                                           Comp: 60 msec, Interp: 0 msec
%4 >> [[i,j] for i in 1..10 | odd? i for j in 1..10]
[[1,1],[3,2],[5,3],[7,4],[9,5]] @ List(List(AldorInteger))
                                           Comp: 10 msec, Interp: 340 msec
-------------------------------------------------------------------------------

I insist on calling this a bug, *not* because of my personal preference of
aldor semantics, but because axiom wastes an opportunity here, since the result
given by axiom is quite useless.

It seems that axiom applies the "such-that" clause to all iterators, rather
than only to the iterator after which it comes.  To be fair, aldor has a
similar problem: it applies the "such-that" clause to *all* iterators before,
with no way to group iterators:

-------------------------------------------------------------------------------
%5 >> [[i,j] for i in 1..10 for j in 1..10 | odd? i]
[[1,1],[3,3],[5,5],[7,7],[9,9]] @ List(List(AldorInteger))
                                           Comp: 10 msec, Interp: 40 msec
%6 >> [[i,j] for i in 1..10 | odd? i for j in 1..10 | even? j]
[[3,2],[7,4]] @ List(List(AldorInteger))
                                           Comp: 10 msec, Interp: 40 msec
-------------------------------------------------------------------------------

I would have thought that parenthesis or braces would group iterators, but they
yield syntax errors instead.

Any hope?  I.e., what I want is:

* group iterators with parens or braces
* apply such-that clauses to all iterators that come before, and are in the
  same group

Martin





reply via email to

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