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: [mg91887] Re: [mg91859] How can I get list form like this
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 11 Sep 2008 06:18:31 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

f = a + b + c + d + e;

f[[#]] & /@ Range[Length[f]]

{a,b,c,d,e}

or more simply

List @@ f

{a,b,c,d,e}

Or, if as you state, f is a List, then a list of its parts is just f

f = {a, b, c, d, e}

{a,b,c,d,e}

(f[[#]] & /@ Range[Length[f]]) == List @@ f == f

True


Bob Hanlon

---- 863 <42838879 at qq.com> wrote: 

=============
Hi,guys

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 ?

Thanks
gyzhou


--

Bob Hanlon



  • Prev by Date: Re: How can I get list form like this
  • Next by Date: Re: How can I get list form like this
  • Previous by thread: Re: How can I get list form like this
  • Next by thread: Re: How can I get list form like this