Up: Sorting Functions   [Contents][Index]


15.7.1 qsort

The standard function qsort has the following prototype:

fun qsort = (any[] array, Comparator cmp_f,
               long left = 0,
               long right = array'length - 1) void

where array is the array to sort, cmp_f is a comparator function, left is the index of the first array element to include in the sorting, and right is the index of the last array element to include in the sorting. Both left and right are optional, and the default is to cover the whole array.

The comparator function cmp_f should have the following prototype:

type Comparator = (any,any):int