예제 #1
0
func Example() {
	cities := []City{
		{"Vancouver", 49.3, -123.1},
		{"Tokyo", 35.6, 139.7},
		{"Honolulu", 21.3, -157.8},
		{"Sydney", -33.9, 151.2},
	}

	fmt.Println(cities)
	sorts.ByUint64(ByLatitude(cities))
	fmt.Println(cities)

	// Output:
	// [Vancouver (49.3, -123.1) Tokyo (35.6, 139.7) Honolulu (21.3, -157.8) Sydney (-33.9, 151.2)]
	// [Sydney (-33.9, 151.2) Honolulu (21.3, -157.8) Tokyo (35.6, 139.7) Vancouver (49.3, -123.1)]
}
예제 #2
0
// Sort is a convenience method.
func (p Uint32Slice) Sort() { sorts.ByUint64(p) }
예제 #3
0
// Sort is a convenience method.
func (p Float64Slice) Sort() { sorts.ByUint64(p) }