Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Need a functional process for this.
Replies: 5   Last Post: Mar 31, 2005 1:50 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steve Gray

Posts: 129
Registered: 12/4/04
Need a functional process for this.
Posted: Mar 30, 2005 3:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have two lists, aa and bb. aa has the general form {2,5,7,9,11,...}
(or{{2},{5},{7},{9},{11},…}}), and bb has the general form {{6,4},{9,2},{5,6},{3,8},…}. If either
the first or second element in any sublist (pair of integers) of bb matches any element in aa, I
want to delete that sublist from bb. In the above example, neither member of {6,4} or {3,8} belongs
to aa, while at least one element of {9,2} and {5,6} belongs to aa, so bb becomes {{6,4},{3,8}}. If
aa had only one element, for example 7, I could do bb=Delete[bb,Position[bb,{x_,7}|{7,y_}]], but I
don't know how to do it for several values instead of just "7" without using a procedural loop.
What is a good functional way to do this?
Thank you for any tips.

Steve Gray




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.