lean into examples
This commit is contained in:
10
examples/sorting-by-functions/sorting-by-functions.sh
Normal file
10
examples/sorting-by-functions/sorting-by-functions.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user