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

MathGroup Archive 2011

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

Search the Archive

Re: Pattern to match element in nested list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122852] Re: Pattern to match element in nested list
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Sat, 12 Nov 2011 07:35:28 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j9irl5$8ee$1@smc.vnet.net>

"JasonE" <ebaughjason at gmail.com> schrieb im Newsbeitrag 
news:j9irl5$8ee$1 at smc.vnet.net...
> This is pretty basic and I am surprised at myself that I can't figure
> this out, but I guess its where I am at.
>
> What pattern would pick students with a score of zero out of this 
> list
> (which is {"student", score}):
>
> {{"Smith, Tim",3},{"Wheres,Waldo",4},{"Muffet, LilMiss",0},{"Brown,
> Charlie",1},{"X, Doctor",0}}
>
>
>
> Thanks,
> Jason
>
> Contact: jasonebaugh at jasonebaugh.info
> Blog: www.jasonebaugh.info/wordpress/
> LinkedIn: www.linkedin.com/in/jasonebaugh
>
Something like this:
t = {{"Smith, Tim", 3}, {"Wheres,Waldo", 4}, {"Muffet, LilMiss", 0}, 
{"Brown, Charlie", 1},
{"X, Doctor", 0}}
    {{"Smith, Tim", 3}, {"Wheres,Waldo", 4}, {"Muffet, LilMiss", 0}, 
{"Brown, Charlie", 1},
    {"X, Doctor", 0}}

Cases[t, {_, 0}]
    {{"Muffet, LilMiss", 0}, {"X, Doctor", 0}}

Regards,
Wolfgang




  • Prev by Date: Re: large integration result for simple problem: 1/x,, also BesselJ
  • Next by Date: Re: dynamic nested loops
  • Previous by thread: Re: Pattern to match element in nested list
  • Next by thread: PDE