MathGroup Archive 1995

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

Search the Archive

Re: Help with lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2804] Re: [mg2782] Help with lists
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Mon, 18 Dec 1995 00:42:52 -0500

Andre Bindon <abindon at gpu.srv.ualberta.ca>
in [mg2782] Help with lists
wants to find how many members of

list = {-5,-4,-3,-2,-1,0,1,2,3,4,5}

lie in the range -2 to 2.

Here's one way (Count takes a pattern as its second entry).

Count[list,x_/;-2<=x<=2]

	5

Of course we can use other patterns for the second entry

Allan Hayes
hay at haystack.demon.co.uk



  • Prev by Date: Re: Help with lists
  • Next by Date: Re: Oh why is life never easy? Need help with |vector|
  • Previous by thread: Re: Help with lists
  • Next by thread: Re: Help with lists