123456789101112131415161718192021222324252627282930313233343536373839 | '\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH List.sorted 3 2026-08-20 "Tomo man-pages"
.SH NAME
List.sorted \- sorted copy of a list
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.sorted\ :\ func(list:\ [T],\ by\ =\ T.compare\ ->\ [T])
.fi
.SH DESCRIPTION
Creates a new list with elements sorted.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
list [T] 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
A new list with sorted elements.
.SH EXAMPLES
.EX
assert [40, 10, -30, 20].sorted() == [-30, 10, 20, 40]
assert [40, 10, -30, 20].sorted(
func(a,b:Int) a.abs() <> b.abs()
) == [10, 20, -30, 40]
.EE
.SH SEE ALSO
.BR Tomo-List (3)
|