Mojo function
sort
sort[T: Copyable, origin: MutOrigin, //, cmp_fn: def(T, T) capturing -> Bool, *, stable: Bool = False, __disambiguate: NoneType = None](span: Span[T, origin])
Sort a span in-place. The function doesn't return anything, the span is updated in-place.
Parameters:
- T (
Copyable): Type of the underlying data. - origin (
MutOrigin): Origin of span. - cmp_fn (
def(T, T) capturing -> Bool): The comparison function. - stable (
Bool): Whether the sort should be stable. - __disambiguate (
NoneType): Give the Scalar overload higher priority. Do not pass explicitly.
Args:
- span (
Span): The span to be sorted.
sort[T: Copyable & Comparable, origin: MutOrigin, //, *, stable: Bool = False](span: Span[T, origin])
Sort a span of comparable elements in-place.
Parameters:
- T (
Copyable&Comparable): The order comparable collection element type. - origin (
MutOrigin): Origin of span. - stable (
Bool): Whether the sort should be stable.
Args:
- span (
Span): The span to be sorted.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!