You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
364 B
Bash

# Running our program shows a list sorted by string
# length, as desired.
$ go run sorting-by-functions.go
[kiwi peach banana]
# By following this same pattern of creating a custom
# type, implementing the three `Interface` methods on that
# type, and then calling sort.Sort on a collection of that
# custom type, we can sort Go slices by arbitrary
# functions.