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