The |
|
std := load('../vendor/std') log := std.log qs := load('../vendor/quicksort') sortBy := qs.sortBy sort! := qs.sort! sort := qs.sort |
|
We can sort a list in ascending order with |
numbers := [921, 14, 0, 0.002] log(sort(numbers)) |
Function definitions that end in |
temperatures := [33, 1, 5, 22] sort!(temperatures) ` the existing list has changed ` log(temperatures) |
|
menu := { apples: 1.50 oranges: 2.00 coconut: 3.50 grapes: 1.75 } items := ['apples', 'oranges', 'coconut', 'grapes'] ` sort items by their menu price ` log(sortBy(items, item => menu.(item))) |
$ ink sorting.ink {1: 0.00200000, 2: 14, 3: 921, 0: 0} {0: 1, 1: 5, 2: 22, 3: 33} {1: 'grapes', 2: 'oranges', 3: 'coconut', 0: 'apples'} |
Next example: Execing Processes.