Sort Numbers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sort Numbers

summeryang000
Banned User
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sort Numbers

a soggy fish
summeryang000 wrote
Hi, there. I have a project about a numbers sorting task.
First I chose set `s' as container for unsorted numbers, then
it's sorted after numbers in `s' were dumped into a vector `v'.
Code is listed as blow.

    | v. s. i |
    s: set copy.
    s add: 5. s add: 6. s add: 3. s add: 2. s add: 7. s add:4.
    v: vector copySize: (s size) FillingWith: 0.
    i: 0.
    s do: [| :n | v at: i Put: n. i: i+1 ].
    v

I thought that the set `s' shell give its elements in the order
the same as of those elements coming. But eventually `v' put
those numbers in ascending order.

Does anyone know why it is that?
no
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sort Numbers

PlayShadowrun
Administrator
I have to say, it was pretty slick adding the spam into the signature.
Always remember, those who play Shadowrun are better than those who don't.
Loading...