Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7953

Re: opposite of AppendTo

From Fred Simons <f.h.simons@tue.nl>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: opposite of AppendTo
Date 2012-01-17 10:58 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jf3k98$q73$1@smc.vnet.net> (permalink)
References <201201162212.RAA15438@smc.vnet.net>

Show all headers | View raw


Is this what you are looking for?

In[8]:= Attributes[mydelete]={HoldFirst};
mydelete[s_, e_] := s=DeleteCases[s,e]

In[10]:= s=Range[5];
mydelete[s,3];
s
Out[12]= {1,2,4,5}

Fred Simons
Eindhoven University of Technology

Op 16-1-2012 23:12, burke schreef:
> AppendTo[s,e] appends "e" to "s" and then RESETS "s". How does one
> delete or remove an element "e" from a list "s" and then RESET "s"?
> The _reset_ is my problem.  I want to be able to add and delete
> elements of a list (a list of graphical elements with very low
> opacity).  I can "appendto" the list at will but am unable to delete
> elements (using Delete, DeleteCases, Except, Select, etc.). Deleting
> "e" from "s" is easy enough, but resetting "s" seems impossible.
> Help!!
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: opposite of AppendTo Fred Simons <f.h.simons@tue.nl> - 2012-01-17 10:58 +0000

csiph-web