[Top][All Lists]

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

Re: [Axiom-developer] How to enumerate a product of lists (or integer se

From: Martin Rubey
Subject: Re: [Axiom-developer] How to enumerate a product of lists (or integer sets)
Date: 15 Oct 2007 17:03:18 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Francois Maltey <address@hidden> writes:

> > L := concat [concat [concat [[[a,b,c,d] _
> >                               for a in 1..9] _
> >                              for b in 1..9] _
> >                      for c in 1..9] _
> >              for d in 1..9]
> > 
> > and then loop over them:
> > 
> > [eval(matrix [[a,b,15-a-b],[c,d,15-c-d],[15-a-c,15-b-d,15-a-d]], [a,b,c,d], 
> >                 l) for l in L]
> I ignore this way. It's better than this too long command line map :
> map (l +-> matrix [[l.1,l.2,15-l.1-l.2],[...],[...]], L)
> In mupad there is the short-cut
> map ([a,b,c,d] -> matrix [[a,b,15-a-b],[c,d,15-c-d],[15-a-c,15-b-d,15-a-d]], 
> L)

yes, I'd love to have this, too.  I think in aldor it should work.

> The eval seems quite different : 
> the map doesn't create any symbolic matrix 
> but the eval create symbolic matrices. Am I right ?

Well, not the eval, but

matrix [[a,b,15-a-b],[c,d,15-c-d],[15-a-c,15-b-d,15-a-d]]

which really results in the same problem, though.

> But I take note that exercices for my students use a lot of cartesian
> products with $...$... and very view train of for as above.

Well, parallel iteration is not found in many languages, it is really a
strenght of Axiom/Aldor.


reply via email to

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