Re: My first program: sublime (reverse of "extract" function)

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...
SocIoDim said...

NO

I just meant that particular example.

I realized this, but your code is still not the same as mine. Apparently, you do not notice the multiplication.

said...

This won't help your real code though, so it's not worth delving into.

Yes, it does not matter already.

said...

You can do this within the stdlib.

Wow! It is excellent idea! I think it is possible to do even better, because input data is one-dimensional sequence of atoms.

function SortWithIndexes(sequence X) 
    for i = 1 to length(X) do 
        X[i] &= i 
    end for 
    X = sort(X) 
    return {vslice(X, 1), vslice(X, 2)} 
end function 
 
sequence Unsorted = {0.5, 0.3, 0.2, 0.4, 0.1} 
sequence Sorted = SortWithIndexes(Unsorted) 
sequence Indexes = Sorted[2] 
Sorted = Sorted[1] 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu