listSort (Function)

Signature: listSort(list: List<int> | List<string>) -> List<t0>

Description: Returns a new list sorted in ascending order by the elements' natural order: integers by value, strings by byte content. The sort is stable. Only List and List are supported; any other element type is a compile-time error.

Parameters

  • list (List | List): The list to sort

Returns: List

Example

listSort([3, 1, 2])  // [1, 2, 3]
listSort [3, 1, 2]  // [1, 2, 3]