MathGroup Archive 2001

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

Search the Archive

Re: Returning List Position w/o brackets


Brian,

letter = {a,b,c,d};number = {1,2,3,4};

letter[[ Flatten[Position[ number, 2 ] ]]][[1]]

        b

letter[[Sequence@@ Flatten[Position[ number, 2 ] ]]]

        b

letter[[Position[ number, 2 ][[1,1]] ]]

        b

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"brian" <polar at cloud9.net> wrote in message news:9eigli$512 at smc.vnet.net...
> 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: Congruences
  • Next by Date: Re: Returning List Position w/o brackets
  • Previous by thread: Re: Returning List Position w/o brackets
  • Next by thread: A tricky equation