[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: iterators and cartesian product.
From: |
Francois Maltey |
Subject: |
[Axiom-developer] Re: iterators and cartesian product. |
Date: |
21 Oct 2007 20:20:54 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Hello, I have subscribed to the two lists open-axiom and fricas.
Waldek Hebisch <address@hidden> writes:
> Concerning more general problem: I think that we also need other approaches.
> More preciesly, it would be good to add beter iteration constructs, which
> make iterating over products easier. For example, something like:
> [[a, b] for a in 1..10 repeat for b in 1..5]
> Well, concat version creates intermediate lists and concatenates them.
> Psychologically double iteration is an atomic operation,
---------------
> so it is easier (at least for some folks) to think about.
All right Waldek ! It's exactly what I think :
Mathematics writes for (x,y,z) in E X F x G.
And the M... systems allows multiple (not double) iterations
as an atomic operation.
Maple isn't perfect for this because we must quote with ' the inner part
[a $a=0..9]
but ['10*a+b $a=1..9'$b=0..9] and [''10*a+b $a=1..9'$b=0..9'$c=0..9]
At use, Mupad is almost perfect
[a $a=0..9] and [10*a+b $a=1..9$b=0..9] and [10*a+b $a=1..9$b=0..9$c=0..9]
$ is a (right to left)? inner operator.
Of corse parallel iterations must remain as a pretty pure concept of axiom.
The description of these 2 iterations are very short.
It's a right thing to have both in axiom.
About Martin's wish :
---------------------
> What I would like a lot however is something like
> for e in g repeat (a, b) := e ...
> or even for (a, b) in g repeat ...
> given that g returns a Cross.
Other languages allow lists for this uses because they aren't typed.
It's maybe impossible to have parenthesis for cross-product,
because they are used for functions, but a new constructor as [|...,...|]
should be a great progress in the interface.
By example caml uses [1;2;3] for lists and [|1;2;3|] for array.
And mupad allows [a,b] := L when L is a list of 2 terms.
So [a,b] := [b,a] exchanges the values of the variables a and b.
and [a,b,c] := [b,c,a] permutes the 3 values.
The functions makeprod and selectfirst in axiom are too particular
to this domain. Acces and changes by CC.n might be more fluent.
A new constructor ([|...|] or an other) and acces (by Cross.n)
don't overload axiom
because they must exist (do you agree ?),
are easier to describe (do you agree ??),
and are connected to the list-syntax (do you agree ???).
I wait with Martin such operators.
F.
- [Axiom-developer] Re: [fricas-devel] Re: iterators, Martin Rubey, 2007/10/21
- [Axiom-developer] Re: iterators and cartesian product.,
Francois Maltey <=
- [Axiom-developer] Re: [open-axiom-devel] iterators and cartesian product., Ralf Hemmecke, 2007/10/21
- [Axiom-developer] Re: [fricas-devel] Re: iterators and cartesian product., Martin Rubey, 2007/10/22
- [Axiom-developer] Re: [open-axiom-devel] [fricas-devel] Re: iterators and cartesian product., Francois Maltey, 2007/10/22
- [Axiom-developer] Re: [open-axiom-devel] [fricas-devel] Re: iterators and cartesian product., Martin Rubey, 2007/10/22
- [Axiom-developer] Re: iterators and cartesian product., Francois Maltey, 2007/10/22
- [Axiom-developer] Re: [fricas-devel] Re: iterators and cartesian product., Martin Rubey, 2007/10/22
- [Axiom-developer] Re: [fricas-devel] Re: [open-axiom-devel] [fricas-devel] Re: iterators and cartesian product., Martin Rubey, 2007/10/24
- Re: [Axiom-developer] Re: [open-axiom-devel] [fricas-devel] Re: iterators and cartesian product., Gabriel Dos Reis, 2007/10/22