Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: List searching

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57573] Re: [mg57512] List searching
  • From: Selwyn Hollis <sh2.7183 at earthlink.net>
  • Date: Wed, 1 Jun 2005 06:02:41 -0400 (EDT)
  • References: <200505310859.EAA03316@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On May 31, 2005, at 4:59 AM, Guy Israeli wrote:

> Hello,
>
> I needed to test lists for certain elements inside of it, however,  
> since I
> didn't find the proper function I had to write them myself.
>
> are there functions that can do the following:
>
> - tests (returns true or false) if within the list there is an  
> element that
> appears more than once

Try this:

      redundancy[ alist_] := Length[ alist] != Length[ Union[ alist ] ]

>
> - tests if there is an element in the list that is bigger/smaller  
> than a
> certain number

      containsGreater[ alist_, x_] :=  Max[ alist ] > x

      containsLesser[ alist_ , x_] :=  Min[ alist ] < x


------------
Selwyn Hollis
http://www.appliedsymbols.com




  • Prev by Date: Re: reducing the time of constructing a List
  • Next by Date: Re: opposite of partition
  • Previous by thread: Re: FourierTransform
  • Next by thread: Re: List searching