Skip to content

Latest commit

 

History

History
94 lines (59 loc) · 2.35 KB

File-std-sort-ml-1000391650.md

File metadata and controls

94 lines (59 loc) · 2.35 KB

std/sort.ml

Home · Files

Provides the std sort package.

Package: std.sort

Reachable from entry: no

Declarations

isSorted

function isSorted(arr, lessFn)

Checks whether an array is sorted according to the given comparator.

Parameter Type Default Description
arr dynamic — Value supplied for arr.
lessFn dynamic — Value supplied for lessFn.

Source: std/sort.ml:226

sort

function sort(arr)

Stable in-place sort using the default comparator (ascending).

Parameter Type Default Description
arr dynamic — Value supplied for arr.

Source: std/sort.ml:39

sortBy

function sortBy(arr, lessFn)

Stable in-place sort with a custom comparator and O(n log n) comparisons.

Parameter Type Default Description
arr dynamic — Value supplied for arr.
lessFn dynamic — Value supplied for lessFn.

Source: std/sort.ml:46

sortFast

function sortFast(arr)

Faster in-place sort using the default comparator (ascending) - uses an iterative quicksort with insertion-sort fallback for small ranges - not guaranteed stable.

Parameter Type Default Description
arr dynamic — Value supplied for arr.

Source: std/sort.ml:132

sortFastBy

function sortFastBy(arr, lessFn)

Faster in-place sort with a custom comparator - uses an iterative quicksort with insertion-sort fallback for small ranges - not guaranteed stable.

Parameter Type Default Description
arr dynamic — Value supplied for arr.
lessFn dynamic — Value supplied for lessFn.

Source: std/sort.ml:139