September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
43
Task/Sort-stability/OoRexx/sort-stability.rexx
Normal file
43
Task/Sort-stability/OoRexx/sort-stability.rexx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* Rexx */
|
||||
Do
|
||||
cities = .array~of('UK London', 'US New York', 'US Birmingham', 'UK Birmingham',)
|
||||
|
||||
Say; Say 'Original table'
|
||||
Call display cities
|
||||
|
||||
Say; Say 'Unstable sort on city'
|
||||
sorted = cities~copy
|
||||
sorted~sortWith(.ColumnComparator~new(4, 20))
|
||||
Call display sorted
|
||||
|
||||
Say; Say 'Stable sort on city'
|
||||
sorted = cities~copy
|
||||
sorted~stableSortWith(.ColumnComparator~new(4, 20))
|
||||
Call display sorted
|
||||
|
||||
Say; Say 'Unstable sort on country'
|
||||
sorted = cities~copy
|
||||
sorted~sortWith(.ColumnComparator~new(1, 2))
|
||||
Call display sorted
|
||||
|
||||
Say; Say 'Stable sort on country'
|
||||
sorted = cities~copy
|
||||
sorted~stableSortWith(.ColumnComparator~new(1, 2))
|
||||
Call display sorted
|
||||
|
||||
Return
|
||||
End
|
||||
Exit
|
||||
|
||||
display: Procedure
|
||||
Do
|
||||
Use arg CT
|
||||
|
||||
Say '-'~copies(80)
|
||||
Loop c_ over CT
|
||||
Say c_
|
||||
End c_
|
||||
|
||||
Return
|
||||
End
|
||||
Exit
|
||||
Loading…
Add table
Add a link
Reference in a new issue