Re: sort constants confusing
- Posted by Spock Jul 09, 2017
- 2374 views
Can we standardize on rising and falling? These are the simplest English words I can suggest.
In any given language, there is a collating order for characters (graphemes) that is accepted as the 'normal' way to do it, and the most common variation to the normal sequence is to 'reverse' it.
True. The normal order for sorting is ascending. Sort({3,1,5,2,4}) ought to result in {1,2,3,4,5} without any need to explicitly specify the order.
The algorithm(s) in msort.zip all produce ascending order results. To have it descending I simply reverse the result, eg:
s = reverse( sort(s, n) ) -- n is column ['coz I have lots of column sorting processes]
However, because of the stability principle, this is not strictly the same as, eg:
s = sort(s, n, REVERSE)
Nevertheless, YAGNI and Occam's razor
So in the end that would lead to, eg:
s = sort(s) s = sort_reverse(s)
An optional parameter could give the desired column sorting.
Spock