Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: How do I test for existence of a list element?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112685] Re: How do I test for existence of a list element?
  • From: Robert Rosenbaum <robertr at math.uh.edu>
  • Date: Sun, 26 Sep 2010 02:45:30 -0400 (EDT)

I think you're looking for MemberQ

If you're doing a lot of work on lists, I suggest you browse the ListManipulation help files for a while.  Mathematica has a lot of powerful built in functions that might make your work a lot easier.


Best,
Robert



On Sep 25, 2010, at 1:20 AM, Joseph Gwinn wrote:

> I have an application where I am bouncing around in a list, and may
> accidentally ask for an element beyond the end of the list, which causes
> Mathematica to complain and balk, preventing completion.
>
> Is there any way to test for the existence of a list element without
> provoking complaint or balking should the list item fail to exist?
>
> Thanks,
>
> Joe Gwinn
>







  • Prev by Date: Independent Component Analysis? (here you go...)
  • Next by Date: Re: How do I test for existence of a list element?
  • Previous by thread: Re: How do I test for existence of a list element?
  • Next by thread: Re: How do I test for existence of a list element?