MathGroup Archive 2001

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

Search the Archive

Re: Returning List Position w/o brackets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29017] Re: [mg28990] Returning List Position w/o brackets
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Fri, 25 May 2001 01:47:54 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

One way: use Extract instead of Part:

In[1]:=
letters = {a,b,c,d};

In[2]:=
 numbers = {1,2,3,4};

In[3]:=
Extract[letters,Flatten[Position[numbers,2]]]

Out[3]=
b

-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/~andrzej/

on 01.5.24 5:07 PM, brian at polar at cloud9.net wrote:

> Is there a way to have have the Position function return a value without
> the brackets.
> 
> Say there are two lists,
> letter = {a,b,c,d} and number = {1,2,3,4}
> 
> If I call             letter[[2]] I get b
> but if I use        letter[[  Flatten[ Position[ number, 2 ] ]
> ]] I get {b}
> 
> I have several large lists that I am searching through and then
> need to print out the values and I would like to have the brackets
> removed from the text reports.  I hve tried several different methods
> but nothing seems to work.
> 
> Thank for any help    Brian
> 
> 
> 




  • Prev by Date: Re: Returning List Position w/o brackets
  • Next by Date: RE: Returning List Position w/o brackets
  • Previous by thread: Re: Returning List Position w/o brackets
  • Next by thread: Re: Returning List Position w/o brackets