axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Bug in parallel iteration


From: William Sit
Subject: Re: [Axiom-developer] Bug in parallel iteration
Date: Sun, 25 Nov 2007 12:41:19 -0500

Dear Martin:

Your request seems to me to be one for syntactic sugar. Is it that difficult to use:

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

   (1)  [[1,2],[3,4],[5,6],[7,8],[9,10]]
                    Type: List List PositiveInteger

Parallel iteration is supposed to iterate over lists of same length and "1..10 | odd? i" does not form a list correctly, while "i in 1..10 | odd? i" preceded by "for" is not correct syntax. If there were to be a bug, it would be that neither Axiom nor Aldor reported a syntax error.


William

On 25 Nov 2007 11:28:11 +0100
 Martin Rubey <address@hidden> wrote:
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



_______________________________________________
Axiom-developer mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-developer

William Sit, Professor of Mathematics, City College of New York Office: R6/202C Tel: 212-650-5179, Fax: 212-862-0004
Home Page: http://scisun.sci.ccny.cuny.edu/~wyscc/




reply via email to

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