sort_by function:

  • Can also be called as order_by

Sort a list. If the first argument is a list, return list sorted by the second argument.

Examples:

  • running: (sort_by ["12345", "5", "23", "abc", "-1-2", ""], (len .)) will give: ["", "5", "23", "abc", "-1-2", "12345"] Because it sort the elements by their length, so the empty string (length zero) is the first.

  • running: (sort_by true, (len .)) will return nothing

  • running: (sort_by ["12345", "", 10], (len .)) will give: [10, "", "12345"] Because the number 10 has no length, so it will be the first.