axiom-developer
[Top][All Lists]

## [Axiom-developer] Re: iterators and cartesian product.

 From: Francois Maltey Subject: [Axiom-developer] Re: iterators and cartesian product. Date: 22 Oct 2007 12:54:11 +0200 User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

```I play with Tuple :

> (1) -> a:INT:=3
> (2) -> b:INT:=7
> (3) -> (b,a):=(a,b)
> (4) -> a
> (5) -> b

I compare tuple to mupad/maple sequence :

With mupad/maple we can do :

aa := (11,22)         // named sequence
fct := (a,b,c) -> a+b+c
fct (aa,100)          // and get 133
fct (100, aa)         // and get 133

So sequence are spanned in functions and list.

a+b\$a=0..9\$b=0..9
becomes        (0+b,1+b,2+b...9+b)\$b=0..9   // a sequence
and finishs by 0+0,...,9+0,0+1,...,9+9

It isn't a good idea because user makes error in use of functions.
A sequence is ONE identificator but can have several terms : see fct bellow.

So I avoid sequences because I can't read fct (aa,100) as a function
with 3 parameters. It's too special !

Axiom doesn't span Tuple and keeps the parenthesis, it's all right...

I notice we play with Tuple, CartesianProduct and record.
I let record as a computer data structure.

Isn't possible to merge Tuple and CartesianProduct into one domain
with standard operators and take the better of these two domains.

1/ Create it by                    TT := (a,b)
2/ Acces to the field by           TT.1 or TT.2
3/ Maybe change a field by         TT.1 := ...
4/ Have a type for each field      as cartesianProduct.

1/ makeprod in (cartesian)Product isn't a standard function.
and can only be use with 2 arguments, not 3 or any.
2/ TT.1 isn't allowed for Tuple,
select must be use and begins at 0, but index of lists begins at 1.
selectfirst and selectsecond isn't the classical function elt.
4/ Tuple aren't strong typed :
tuple any isn't a cartesianProduct(Integer,String)

```