Skip to content

Instantly share code, notes, and snippets.

@jordan-chalupka
Created May 31, 2020 17:41
Show Gist options
  • Save jordan-chalupka/b3ccb4e5b351519bcf846eb899639ef4 to your computer and use it in GitHub Desktop.
Save jordan-chalupka/b3ccb4e5b351519bcf846eb899639ef4 to your computer and use it in GitHub Desktop.
Using impl to create an implementation of the sort interface
// Len is the number of elements in the collection.
func (Foo) Len() int {
panic("not implemented") // TODO: Implement
}
// Less reports whether the element with
// index i should sort before the element with index j.
func (Foo) Less(i int, j int) bool {
panic("not implemented") // TODO: Implement
}
// Swap swaps the elements with indexes i and j.
func (Foo) Swap(i int, j int) {
panic("not implemented") // TODO: Implement
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment