(39 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH List.sorted 3 2026-03-08 "Tomo man-pages"6 .SH NAME7 List.sorted \- sorted copy of a list8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI List.sorted\ :\ func(list:\ [T],\ by\ =\ T.compare\ ->\ [T])13 .fi14 .SH DESCRIPTION15 Creates a new list with elements sorted.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 list [T] The list to be sorted. -26 by The comparison function used to determine order. If not specified, the default comparison function for the item type will be used. T.compare27 .TE28 .SH RETURN29 A new list with sorted elements.31 .SH EXAMPLES32 .EX33 assert [40, 10, -30, 20].sorted() == [-30, 10, 20, 40]34 assert [40, 10, -30, 20].sorted(35 func(a,b:&Int) a.abs() <> b.abs()36 ) == [10, 20, -30, 40]37 .EE38 .SH SEE ALSO39 .BR Tomo-List (3)