Hello, > > [...L[i]...LL[i]... for i in 1 .. min([4, length L, length LL])] > > vs the shorter [...x...xx... for x in L for xx in LL for k in 1..4] for > > axiom > > OK, I don't like MuPad's syntax then :-)
I forget the zip function because I never use it : zip ((x,y) -> x+y, [10,20,30], [$1..8]) // answers [11,22,33] as [x+y for x in [10,20,30] for y in 1..8] -- with axiom > [matrix [[a,b,15-a-b],[c,d,15-c-d]] _ > for (a,b,c,d) in CartesianProduct([1..9, 1..9, 1..9, 1..9])] Why not ? But what is the signature of this function CartesianProduct ? It must allow any kind of intervals or lists. as CartesianProduct (L, 1..9). So it might be necessary to have this operator in the kernel, Domains might be not enough flexible... > or, maybe > > [((a,b,c,d) := e; matrix [[a,b,15-a-b],[c,d,15-c-d]]) _ > for e in CartesianProduct([1..9, 1..9, 1..9, 1..9])] I dislike... Two instructions for one calculus ! Matching might be automatic. > > In fact, it nearly works: > --------------------------------------------------------------------------- > (1) -> l := [[1,2], [3,4]] > (2) -> [a,b] := first l > ... > > This command breaks this previous mathematical set > I do not understand this sentence at all. I explain why I dislike the concat command. The concat command : concat [concat [[[matrix [[a,b,15-a-b],[c,d,15-c-d]] for a in 1..9] for b in 1..9] for c in 1..9] for d in 1..9] builds Union_{for d} (Union_{for c} (Union_{for b} set of matrix for a) and isn't a mathematic translation of a cartesian product. but > [matrix [[a,b,15-a-b],[c,d,15-c-d]] _ > for (a,b,c,d) in CartesianProduct([1..9, 1..9, 1..9, 1..9])] is exactly the mathematic form of a Cartesian product. It seems better. F. _______________________________________________ Axiom-developer mailing list Axiom-developer@nongnu.org http://lists.nongnu.org/mailman/listinfo/axiom-developer