MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How can this MapAt application be done more efficiently


A possible solution is:

In[1]:= l = {{5, 0}, {4, 1}, {3, 2, 0}, {3, 1, 1}}

Out[1]= {{5, 0}, {4, 1}, {3, 2, 0}, {3, 1, 1}}

In[2]:= Position[l , 0 ]  

Out[2]= {{1, 2}, {3, 3}}

In[11]:= Delete[ l , %2 ]

Out[11]= {{5}, {4, 1}, {3, 2}, {3, 1, 1}}


so you can combine all in your function:

 dropzero[mylist_] := Delete[ mylist , Position[ mylist , 0 ]]

 :-)

 
 a + andrei

______________________________________________________________________
  Andrei Constantinescu               constant at athena.polytechnique.fr   
                                                                       
  LMS Ecole Polytechnique                  tel:   (33)-1-69.33.33.30
  91128 PALAISEAU cedex - FRANCE           fax:   (33)-1-69.33.30.26    


==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Nonlinear Fit ... Errors and covariance.
  • Next by Date: Polynomial problems.
  • Previous by thread: Re: How can this MapAt application be done more efficiently
  • Next by thread: Re: How can this MapAt application be done more efficiently