Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Select from list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61060] Re: Select from list
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 9 Oct 2005 01:35:10 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <di7r7c$koa$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Steven Taracevicz wrote:
> 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,

A pure function MUST end with the symbol '&', that is the test #<0 must 
be written "# < 0 &" (without the quotes or double quotes). For instance

In[1]:=
data = {-10, -9, -7, -3, 1, 3, 3, 17};
Select[data, #1 < 0 & ]

Out[2]=
{-10, -9, -7, -3}

Best regards,
/J.M.


  • Prev by Date: Language vs. Library
  • Next by Date: Import Limitations
  • Previous by thread: Re: Select from list
  • Next by thread: LU factorization and solving algorithms in Mathematica