(41 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH List.sort 3 2026-03-08 "Tomo man-pages"6 .SH NAME7 List.sort \- sort a list8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI List.sort\ :\ func(list:\ @[T],\ by\ =\ T.compare\ ->\ Void)13 .fi14 .SH DESCRIPTION15 Sorts the elements of the list in place in ascending order (small to large).18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 list @[T] The mutable reference to 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 Nothing.31 .SH EXAMPLES32 .EX33 list := &[40, 10, -30, 20]34 list.sort()35 assert list == [-30, 10, 20, 40]37 list.sort(func(a,b:&Int) a.abs() <> b.abs())38 assert list == [10, 20, -30, 40]39 .EE40 .SH SEE ALSO41 .BR Tomo-List (3)