Re: Help with lists
- Subject: [mg2804] Re: [mg2782] Help with lists
- From: hay at haystack.demon.co.uk (Allan Hayes)
- Date: Mon, 18 Dec 1995 00:42:52 -0500
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
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