Function: math[seqnest] - creates list of lists (of lists ...)
Calling Sequence:
seqnest(expr, r1, r2, ..., rn);
seqnest(expr, r1, r2, ..., rn, 'inert');
Parameters:
expr
- any algebraic expression
r1, r2, ..., rn
- expressions of type name=range
'inert'
- the name
Description:
In the first form, seqnest creates a list of lists (which may contain further lists) by performing nested calls to seq. Thus
seqnest(expr, r1, r2, ..., rn) = [seq([seq([ ... [seq(expr, rn)], ...], r2)], r1)]).
The return is a list of lists (of lists ...). Note that the rightmost range passed to seqnest creates the innermost list.
In the second form, seqnest works like described above but returns an unevaluated expression of the nested seq statements.
Note that the index variables should not be assigned when calling seqnest; otherwise an error occurs.
Internally, seqnest uses strings to create the statement of nested calls to seq.
This function is part of the math package, and so can be used only after performing the command with(math) or with(math, seqnest).
Examples:
> with(math, seqnest):
> llist := seqnest(0, i=1 .. 3, j=1 .. 3, k=1 .. 3);
> array(llist);
> seqnest(0, i=1 .. 3, j=1 .. 3, k=1 .. 3, inert);
> %;
> f := (x, y) -> x*y:
> seqnest(f(x, y), x= 1..3, y=1 .. 3);
> array(1..3, 1..3, %);
See Also:
seq , math/seqby , math/recseq .
Version History:
Version 1.0 - March 15, 1998