MathGroup Archive 2001

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

Search the Archive

RV: Returning List Position w/o brackets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29014] RV: [mg28990] Returning List Position w/o brackets
  • From: "Higinio Ramos" <higra at gugu.usal.es>
  • Date: Fri, 25 May 2001 01:47:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

----- Original Message -----
From: Higinio Ramos <higra at gugu.usal.es>
To: mathgroup at smc.vnet.net
Subject: [mg29014] RE: [mg28990] Returning List Position w/o brackets


>
> ----- Original Message -----
> From: brian <polar at cloud9.net>
To: mathgroup at smc.vnet.net
> To: <mathgroup at smc.vnet.net>
> Sent: Thursday, May 24, 2001 10:07 AM
> Subject: [mg29014] [mg28990] Returning List Position w/o brackets
>
>
> > 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
> >
> >
> perhaps there is no the better way, but it works
>
> In[23]:=
> letter[[Apply[Sequence, Flatten[Position[ number, 2 ]]]]]
> Out[23]=
> b
Or simply
In[44]:=
 letter[[ Flatten[ Position[ number, 2 ] ] ]][[1]]
Out[44]=
b



  • Prev by Date: Re: MathGL3D: Keep axis when exporting to VRML ?
  • Next by Date: Re: Help fitting Exponential curves
  • Previous by thread: RE: Re: Can this be made cleaner and more efficient?
  • Next by thread: Importing EPS