Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Finding shared element in two lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114072] Finding shared element in two lists
  • From: Jason Ebaugh <ebaughjason at gmail.com>
  • Date: Mon, 22 Nov 2010 07:40:47 -0500 (EST)

I am trying to write a function that would take two lists of increasing more
precise location, and return the most specific level of geography that they
share.

myhouse={"Earth", "North America", "USA", "Illinois", "Champaign County",
"Urbana"};
friendshouse={"Earth", "North America", "USA", "Minnesota", "Ramsey County",
"St. Paul"};

In this case, the function should output USA.

I could do this procedurally well enough. But I am really trying to get
comfortable with functional programming.



The above is just a more digestible version of what I am really trying to
do. I want to find the lowest level of taxonomy that two species share.

Ex:
aphid={"Insecta", "Dicondylia", "Pterygota", "Neoptera", "Paraneoptera",
"Hemiptera", "Sternorrhyncha", "Aphidiformes", "Aphidomorpha", "Aphidoidea",
"Aphididae", "Aphidinae", "Macrosiphini", "Acyrthosiphon"};
mosquito={"Insecta", "Dicondylia", "Pterygota", "Neoptera", "Endopterygota",
"Diptera", "Nematocera", "Culicimorpha", "Culicoidea"};

answer = Neoptera


Thank a 10^6,
Jason


-- 
Jason Ebaugh, PhD.

Personal communications: ebaughjason at gmail.com
Business communications: jason.ebaugh at apisscientific.com
Dissertation: http://hdl.handle.net/2142/13005
Linkedin:
http://www.linkedin.com/profile?viewProfile=&key=22842228&locale=en_US&trk=tab_pro
Need bioinformatics help? www.apisscientific.com



  • Prev by Date: Determining the Number of Musical Measures
  • Next by Date: Question on FinancialDerivative in Ver 8
  • Previous by thread: Determining the Number of Musical Measures
  • Next by thread: Re: Finding shared element in two lists