Mojo function
sort
sort[: origin.set, type: CollectionElement, origin: MutableOrigin, //, cmp_fn: fn($1|1, $1|1) capturing -> Bool, *, stable: Bool = False](span: Span[type, origin])
Sort the list inplace. The function doesn't return anything, the list is updated inplace.
Parameters:
- type (
CollectionElement
): CollectionElement type of the underlying data. - origin (
MutableOrigin
): Origin of span. - cmp_fn (
fn($1|1, $1|1) capturing -> Bool
): The comparison function. - stable (
Bool
): Whether the sort should be stable.
Args:
- span (
Span[type, origin]
): The span to be sorted.
sort[: origin.set, origin: MutableOrigin, //, cmp_fn: fn(Int, Int) capturing -> Bool, *, stable: Bool = False](span: Span[Int, origin])
Sort the list inplace. The function doesn't return anything, the list is updated inplace.
Parameters:
- origin (
MutableOrigin
): Origin of span. - cmp_fn (
fn(Int, Int) capturing -> Bool
): The comparison function. - stable (
Bool
): Whether the sort should be stable.
Args:
- span (
Span[Int, origin]
): The span to be sorted.
sort[: origin.set, type: DType, origin: MutableOrigin, //, cmp_fn: fn(SIMD[$1|1, 1], SIMD[$1|1, 1]) capturing -> Bool, *, stable: Bool = False](span: Span[SIMD[type, 1], origin])
Sort the list inplace. The function doesn't return anything, the list is updated inplace.
Parameters:
- type (
DType
): DType type of the underlying data. - origin (
MutableOrigin
): Origin of span. - cmp_fn (
fn(SIMD[$1|1, 1], SIMD[$1|1, 1]) capturing -> Bool
): The comparison function. - stable (
Bool
): Whether the sort should be stable.
Args:
- span (
Span[SIMD[type, 1], origin]
): The span to be sorted.
sort[origin: MutableOrigin, //, *, stable: Bool = False](span: Span[Int, origin])
Sort the list inplace. The function doesn't return anything, the list is updated inplace.
Parameters:
- origin (
MutableOrigin
): Origin of span. - stable (
Bool
): Whether the sort should be stable.
Args:
- span (
Span[Int, origin]
): The span to be sorted.
sort[type: DType, origin: MutableOrigin, //, *, stable: Bool = False](span: Span[SIMD[type, 1], origin])
Sort the list inplace. The function doesn't return anything, the list is updated inplace.
Parameters:
- type (
DType
): CollectionElement type of the underlying data. - origin (
MutableOrigin
): Origin of span. - stable (
Bool
): Whether the sort should be stable.
Args:
- span (
Span[SIMD[type, 1], origin]
): The span to be sorted.
sort[type: ComparableCollectionElement, origin: MutableOrigin, //, *, stable: Bool = False](span: Span[type, origin])
Sort list of the order comparable elements in-place.
Parameters:
- type (
ComparableCollectionElement
): The order comparable collection element type. - origin (
MutableOrigin
): Origin of span. - stable (
Bool
): Whether the sort should be stable.
Args:
- span (
Span[type, origin]
): The span to be sorted.

Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!