1234567891011121314151617181920212223242526272829303132333435363738394041 | '\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH List.sort 3 2026-03-08 "Tomo man-pages"
.SH NAME
List.sort \- sort a list
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.sort\ :\ func(list:\ @[T],\ by\ =\ T.compare\ ->\ Void)
.fi
.SH DESCRIPTION
Sorts the elements of the list in place in ascending order (small to large).
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
list @[T] The mutable reference to the list to be sorted. -
by The comparison function used to determine order. If not specified, the default comparison function for the item type will be used. T.compare
.TE
.SH RETURN
Nothing.
.SH EXAMPLES
.EX
list := &[40, 10, -30, 20]
list.sort()
assert list == [-30, 10, 20, 40]
list.sort(func(a,b:&Int) a.abs() <> b.abs())
assert list == [10, 20, -30, 40]
.EE
.SH SEE ALSO
.BR Tomo-List (3)
|