Function: sort_list

Function: sort_list


 sort_list(some_list, order_by: some_function)

Order the elements in a list in lexicographical order, from smallest to largest. Optionally order by some other property.


Parameter Type Description
input list or set List to sort.
order_by function (optional) Function to order by, for example when order_by: {} orders items by their name property.
remove_duplicates boolean
since 0.3.7
If true, keep only one copy of duplicate elements.


 sort_list([5,2,3,1,4])          ==  [1,2,3,4,5]
 sort_list(["aaa","cccc","bb"])  ==  ["aaa","bb","cccc"]
 sort_list(["aaa","cccc","bb"], order_by: length)
                                 ==  ["bb","aaa","cccc"]
 sort_list([1,2,1,2,2,3], remove_duplicates:true)  ==  [1,2,3]