sort multimethod
Methods
- sort(a:Arr, lte:Fun=method) Source: stdlib.ngs:2157
Sort an array. Parameters
lte Less-then-or-equal function to use for comparison of the items in a Returns
ArrExample
sort([0,5,3,-1], (<=)) # [-1, 0, 3, 5]
- sort(a:Arr, field:Str, lte:Fun=method) Source: stdlib.ngs:2170
Sort an array based on field value Parameters
lte Less-then-or-equal function to use for comparison of the items' fields Returns
ArrExample
[{'x': 1}, {'x': 5}, {'x': 3}].sort('x') # [{'x': 1}, {'x': 3}, {'x': 5}]
- sort(h:Hash, lte:Fun=method) Source: stdlib.ngs:2628
Sort a Hash. Parameters
lte Less-then-or-equal function to use for comparison of the keys in h Returns
HashExample
{"b": 2, "c": 3, "a": 1}.sort() # {"a": 1, "b": 2, "c": 3}