MathGroup Archive 2005

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

Search the Archive

Re: List searching

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57558] Re: List searching
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 1 Jun 2005 06:01:46 -0400 (EDT)
  • References: <d7h9gm$3go$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

HelloGuy,
see below
sincerely, Daniel

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
we could use Mathematicas pattern matcher to do the job:
dat /. {{___, x_, ___, x_, ___} -> True, _List -> False}
this replaces a list with equal elements by True, if no match is found 
the list is replaced by False. We can make this into a function:
# /. {{___, x_, ___, x_, ___} -> True, _List -> False}&
> 
> - tests if there is an element in the list that is bigger/smaller than a 
> certain number
a simple and fast way may be to test  the Max/Min. E.g.
  Max[dat]>5
if we want a function:
Max[#]>5&
> 
> I would really appreciate your help,
> 
> Guy 
> 
> 


  • Prev by Date: Re: Related quastions. Question 2
  • Next by Date: Re: What is causing this error message?
  • Previous by thread: Re: List searching
  • Next by thread: Re: List searching