Think for instance of a user interface with a table, with a few columns of which the user could sort on. A traditional user interface uses stable sorts, so if the the user first sorts on column 1 and then on column 2, the result will be sorted on column 2, but if two elements are equal in that column the previous sort will make those element sort internally on column 1:
1 2 abc hej ghi hej def fii
1< 2
abc hej def fii {sort(column(table,1),table)} ghi hej
1 >2< abc hej ghi hej {sort(column(table,2),table)} def fii
and not
1 >2< ghi hej abc hej def fii
This can of course be passed by by remembering the previous sorts, and make a comparison function that uses those. But a stable sort would sometimes be much nicer.
/ Mirar
Previous text:
2003-04-23 16:37: Subject: Re: sort
yes, but how do you know they are being reordered, if they are equal? and what problems could that create?
greetings, martin.
/ Brevbäraren