[Tutor] extracting elements in a sequence
Sean 'Shaleh' Perry
shalehperry@attbi.com
Mon Feb 10 01:40:03 2003
On Sunday 09 February 2003 13:10, Tim Johnson wrote:
> * Sean 'Shaleh' Perry <shalehperry@attbi.com> [030209 09:36]:
> > On Sunday 09 February 2003 09:34, Tim Johnson wrote:
> > > Hello All:
> > > Is there a builtin way to extract elements in a series
> > > as in
> > > test =3D [1,'one',2,'two',3,'three']
> > > extract(test,2)
> > > =3D [1,2,3]
> > > or extract(test,3)
> > > =3D [1,'two']
> > > If so, pointers to documentation would be appreciated.
> >
> > eh? uh? what?
> >
> > why does extract(test, 2) return [1,2,3]? This example just does not
> > parse for me.
>
> Sorry to confuse you. Perhaps you would choose a better word.
>
> You see the results: One would iterate through the collection,
>
> taking (if 2 the first of two, if 3 the first of 3, etc.)
> I used the word 'extract' because I'm coming from a different
> language....
>
ok. "if 2 the first of two". Do you mean the first two items which woul=
d be=20
(1, 'one')? The second example of extract(3) returning (1, 'two') is=20
particularly puzzling to me.
Why is (1, 2, 3) what you expect from extract(2)?
> HTH
not really, but we can work it out (-: