Re: Help with Delete cases
- To: mathgroup at smc.vnet.net
- Subject: [mg116252] Re: Help with Delete cases
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 8 Feb 2011 05:07:25 -0500 (EST)
On 2/7/11 at 6:06 AM, ramsey2879 at msn.com (KenR) wrote: >I have a list= Range I want to delete cases of n = m(m+1) mod >P from the list, but Delete cases only deletes cases matching a >pattern, i.e. >list = DeleteCases[list,Mod[N - m(m+1)/2,P] = 0] will definitely not >work. I want to keep list, as the same identifier, throughout since >this is within a looping process. Any suggestions? Change the code to be something like: list = DeleteCases[list,_?(Mod[#(#+1)/2,P] == #&)] That is use a pure function to set up a test that is true for the things you want to delete.