Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleCompact (0.1 sec)

  1. src/slices/example_test.go

    	}
    	n, found := slices.BinarySearchFunc(people, Person{"Bob", 0}, func(a, b Person) int {
    		return strings.Compare(a.Name, b.Name)
    	})
    	fmt.Println("Bob:", n, found)
    	// Output:
    	// Bob: 1 true
    }
    
    func ExampleCompact() {
    	seq := []int{0, 1, 1, 2, 3, 5, 8}
    	seq = slices.Compact(seq)
    	fmt.Println(seq)
    	// Output:
    	// [0 1 2 3 5 8]
    }
    
    func ExampleCompactFunc() {
    	names := []string{"bob", "Bob", "alice", "Vera", "VERA"}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 10 17:28:50 UTC 2024
    - 8.1K bytes
    - Viewed (0)
Back to top