axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] Re: [open-axiom-devel] iterators and cartesian product


From: Ralf Hemmecke
Subject: [Axiom-developer] Re: [open-axiom-devel] iterators and cartesian product.
Date: Sun, 21 Oct 2007 22:11:21 +0200
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

It's maybe impossible to have parenthesis for cross-product, because they are used for functions,

Parentheses are used for grouping. You know that , (comma) in Aldor is an operator (with a very low precedence) that forms so called multivalues? So in

  a, b := b, a

you must have parens around (a,b) and (b,a) if you mean a parallel assignment. Otherwise it would parse as

  a, (b:=b), a

but a new constructor as [|...,...|] should be a great progress in the interface.

There is no more syntax needed.

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 it already works in Axiom.

(1) -> a:INT:=3

   (1)  3
                                Type: Integer
(2) -> b:INT:=7

   (2)  7
                                Type: Integer
(3) -> (b,a):=(a,b)

   (3)  7
                                Type: Integer
(4) -> a

   (4)  7
                                Type: Integer
(5) -> b

   (5)  3
                                Type: Integer

> and [a,b,c] := [b,c,a] permutes the 3 values.

(6) -> c:INT := 1

   (6)  1
                                Type: Integer
(7) -> (a,b,c) := (b,c,a)

   (7)  7
                                Type: Integer
(8) -> a

   (8)  3
                                Type: Integer
(9) -> b

   (9)  1
                                Type: Integer
(10) -> c

   (10)  7
                                Type: Integer

Ralf




reply via email to

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