-----maxima-bounces at math.utexas.edu wrote: -----
>in?experimenting?with?lists?(in?wxMaxima)?the?following?dialogue?occured:
>
>input:????????????????E1?:?[1,0,2,0,0,3,0,0,0,4];
>input:????????????????delete(0,?E1);
>output:??????????????[1,?2,?0,?3,?0,?4]
>
>The?Maxima?manual?suggests?that?all?zeroes?should?be?deleted.??Why?is
>this?not?the?case???Is?there?an?elegant?way?to?delete?all?the?zeroes?
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 suggest using the function sublist; it's more appropriate for lists
than is 'delete':
(%i8) sublist([1,0,2,0,0,3,0,0,0,4], lambda([s], is(s # 0)));
(%o8) [1,2,3,4]
User documentation:
Function: sublist (list, p)
Returns the list of elements of list for which the predicate p returns
true.
If you have more questions or comments, let us know.
Barton