Charles Greathouse on Sat, 15 Jun 2013 15:42:49 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Enumerating and eliminating

(the right address is )

You could store them in a list. So

v=List(); for(k=1,10,x=k+3;if(x<10,listput(v, x))); vecsort(Vec(v))


v=List(); for(k=1,5,if(k<3,y=k,y=k-2);listput(v, y)); vecsort(Vec(v),,8)

Charles Greathouse
Case Western Reserve University

On Sat, Jun 15, 2013 at 8:36 AM, Phuongha <> wrote:
Could you please help me to enumerate and eliminate elements of a set?
For example, from a loop:
for(k=1,10,x=k+3;if(x<10,print(x," ",k)))
I get the result:
4 1
5 2
6 3
7 4
8 5
9 6
And I want to enumerate the values of x as x[1]=4,....,x[6]=9.

Another example:
and the result:

Here I have 2 values of y are repeated (1 and 2) and I would like to
eliminate them and write a set A={value of y}={1,2,3} and then enumerate the
values of y as y[1]=1,y[2]=2,y[3]=3...

However, I do not know how to do this @@.
I wonder if there is someone help me solve it?

Thank you so much.
Phuong Ha.