MathGroup Archive 2008

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

Search the Archive

Re: How can I get list form like this

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91883] Re: How can I get list form like this
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 11 Sep 2008 06:17:47 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <ga82tt$rh1$1@smc.vnet.net>

863 wrote:

> As we know f/@Range[n] gives a list {f[1],f[2],f[3],=85=85};
> Here what I want is a list form like this{f[[1]],f[[2]],=85=85}(*It's too
> tedious to type one by one*)
> It means the 1st,2nd,=85=85part of list f.
> Looks similar to each other, however I can't figure it out.
> How to do this ?

Map a pure function such as f[[#]]&. For instance, depending on whether 
the expression holds some values before the mapping or not,

In[1]:= f = {1.1, 1.2, 1.3};
(f[[#1]] & ) /@ Range[3]

Out[2]= {1.1, 1.2, 1.3}

In[3]:= (HoldForm[g[[#1]]] & ) /@ Range[3]
g = {1, 2, 3};
ReleaseHold[%%]

Out[3]= {HoldForm[g[[1]]], HoldForm[g[[2]]], HoldForm[g[[3]]]}

Out[5]= {1, 2, 3}

Regards,
-- Jean-Marc


  • Prev by Date: Re: How to simplify ArcCos[x/Sqrt[x^2+y^2]] to Pi/2-ArcTan[x/Abs[y]]?
  • Next by Date: Problems with Frame in ListPlots with Legends
  • Previous by thread: Re: How can I get list form like this
  • Next by thread: Problem with replacement rules