Re: Select from list
- To: mathgroup at smc.vnet.net
- Subject: [mg61076] Re: Select from list
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 9 Oct 2005 01:35:55 -0400 (EDT)
- References: <di7r7c$koa$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Steven Taracevicz schrieb:
> hi:
>
> I read a text file that gives me a list.
> nLevel[8, 10] = Import["output8_10.txt", "List"]
>
> {-10,-9,-7,-3,1,3,3,17}
>
> I have no problems calculating mean, variance etc. with the list.
>
> When I use:
>
> Select[nLevel[8,10], #<0]
>
> yields
>
> {}
>
> despite negative elements.
>
> I cannot figure out why.
>
> Thanks,
>
Hi Steven,
pure functions end with an ampersand (or are written using Function)
Select[nlevel[8, 10], #1 < 0 & ]
and
Select[nlevel[8, 10], Function[test, test < 0]]
both return
{-10, -9, -7, -3}