Re: [Harbour] Sorting the array

2009-12-03 Thread Mindaugas Kavaliauskas

Hi,


asort(atst,{|x,y|x[2]y[2]})

what rule asort use in this case?


Just like always, it uses the 4th parameter of ASORT().


Regards,
Mindaugas
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Sorting the array

2009-12-03 Thread vatzct

Mindaugas Kavaliauskas написав(ла):

Hi,


asort(atst,{|x,y|x[2]y[2]})

what rule asort use in this case?


Just like always, it uses the 4th parameter of ASORT().


Regards,
Mindaugas
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Yes of cause you are right, i'm not carefully read doc, but result is 
same with asort(atst,,,{|x,y|x[2]y[2]})


before sorting
1  6.06  1  1
2  9.92  1  2
3  9.90  1  3
4  9.34  1  4
5 11.38 1  5
after sorting
1  9.90  1  3
2  6.06  1  1
3  9.34  1  4
4  9.92  1  2
5 11.38 1  5


Regards,
Alexey Myronenko
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Sorting the array

2009-12-03 Thread Viktor Szakáts
 Yes of cause you are right, i'm not carefully read doc, but result is same 
 with asort(atst,,,{|x,y|x[2]y[2]})
 
 before sorting
1  6.06  1  1
2  9.92  1  2
3  9.90  1  3
4  9.34  1  4
5 11.38 1  5
 after sorting
1  9.90  1  3
2  6.06  1  1
3  9.34  1  4
4  9.92  1  2
5 11.38 1  5

I don't see any problem.

Harbour doesn't use a 'stable' sorting algorithm, 
so it doesn't keep original order of identical keys.

I don't know what Clipper uses, but even if it 
gives different results this is an implementation 
detail, which app code should not rely upon.

All ASORT() guarantees is that keys will be ordered 
as requested.

Extend your key if have some extra needs regarding 
the ordering.

Brgds,
Viktor

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour