[Maxima] Maxima lists and the delete function
macrakis at alum.mit.edu
Sat Mar 21 17:40:06 CDT 2009
On Sat, Mar 21, 2009 at 6:11 PM, Barton Willis <willisb at unk.edu> wrote:
> The user documentation needs improvement; there is a clause
> about deleting either a term or a factor, but the user documentation
> doesn't say what happens in other cases (non-term and non-factor).
I agree that the user documentation needs improvement here. It
doesn't mention the most important thing: it deletes all occurrences
of expr1 from <<<the top level argument list>>> of expr2. If expr2 is
a list, that is its members, if it is a sum, it is its terms, if it is
a product, it is its factors, if it is a function application, it is
its arguments, etc. In effect, it works on args(expr1).
The way it currently reads, you might think it deletes expr1 from
*anywhere* in expr2, including functional position, nested uses, etc.
For example, as_documented_delete(x,[ [1,x,2], x(3) ] ) => [ [1,2],
??(3) ] or something.
But the actual behavior is delete(f,f(f,f(2,3,f))) => f( f(2,3,f) ).
> I suggest using the function sublist; it's more appropriate for lists than is 'delete':
Though sublist works *only* for lists, and not for function
applications in general, delete is perfectly appropriate for lists,
which as far as Maxima is concerned, are simply function applications
where the function is "[", just as sums are function applications
where the function is "+".
More information about the Maxima