MathGroup Archive 2001

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

Search the Archive

Re: Extract Elements from a List?

  • To: mathgroup at
  • Subject: [mg28979] Re: Extract Elements from a List?
  • From: "Allan Hayes" <hay at>
  • Date: Thu, 24 May 2001 04:06:56 -0400 (EDT)
  • References: <9efk6g$>
  • Sender: owner-wri-mathgroup at

"Robert Schuerhuber" <robert.schuerhuber at> wrote in message
news:9efk6g$1d8 at

> i need to extract elements from a list, starting th element number x and
> than taking every yth element, eg:
> with
> list={a,b,c,d,e,f,g,h,i,j}
> start=3;
> step=2:
> i'd like to get the list
> {c,e,g,i}.



   Take[list, {m, n, s}] gives elements m through n in steps of s.

So with,


we get

Take[lst, {start, -1,2}]


For negative integers the position n is the -n th, counting left with the
last position given by -1.

Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Re: Q: Extract Elements from a List?
  • Next by Date: RE: Q: Extract Elements from a List?
  • Previous by thread: Re: A tricky equation
  • Next by thread: Left-hand Sum, etc?