partition



On 8/8/05, Alexandre Campos  wrote:
> 
> That's exactly what I need! ... so, I tried to extract the values of
> the set but I don't know the type of the result set variable, e.g.
> I require  to assign the element "2": first element of the second "row" in:
[...]
> But is A a matrix, an array, a list ? how can I extract its
> components.

A fairly general approach is to use the args function --
args (set (a, b, c))  =>  [a, b, c]
then you can index the element you want.

Maxima objects such as sets are essentially indistinguishable 
from unevaluated function calls -- typically the object type is 
indicated by an operator (`set' in this case) and the bits of the
object are represented as arguments of the operator.
The displayed representation may well be something different
from operator (arg_1, ..., arg_n) but the internal representation
is the same.

e.g.
args (f (x) := x^2)  =>  [f (x), x^2], 
args ('(if a > b then c else d))  =>  [a > b, c, true, d]
args ('(for i:1 thru 10 do print (foo (i))))  => parts of for-loop

Incidentally the corresponding function to get the operator
is op (expr).

For what it's worth,
Robert Dodier