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


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

Re: Removing list elements in x by list y

From Ulrich Arndt <ulrich.arndt@data2knowledge.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Removing list elements in x by list y
Date 2013-06-14 08:49 +0000
Message-ID <kpelf1$hrj$1@smc.vnet.net> (permalink)
References <20130613063635.3F7206A2A@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


There will be many other ways to do that but this works for the example
Delete[x, Flatten[Position[x, #] & /@ y, 1]]

But what would you expect as a result in case of y = {u,w}?


Am 13.06.2013 um 08:36 schrieb Dr. Wolfgang Hintze:

> I have simple question.
> 
> Given two lists
> 
> x = {u, v, w, w, d};
> y = {u, d};
> 
> I wish to "subtract" y from x, i.e. remove exactly the elements in x
> which belong to y giving
> 
> x "-" y = {v,w,w}
> 
> Complement[] gives instead {v,w}.
> Note that we are talking about lists rather than sets.
> 
> I'm sure there is a simple standard command, but I can't find it.
> Can you?
> 
> Regards,
> Wolfgang
> 

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


Thread

Re: Removing list elements in x by list y Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2013-06-14 08:49 +0000

csiph-web