package main

import (
	"fmt"
	"slices"
)

func main() {
	// section: example
	strings := []string{"Apple", "Orange", "Apple", "Banana"}
	ints := []int{0, 1, 1, 2, 0, 5, 7, 5}
	strings = slices.Compact(strings)
	ints = slices.Compact(ints)
	fmt.Printf("Not Sorted - Compact does not work\n")
	fmt.Println(strings)
	fmt.Println(ints)

	fmt.Printf("\nSorted - Compact now works as expected\n")
	slices.Sort(ints)
	slices.Sort(strings)
	strings = slices.Compact(strings)
	ints = slices.Compact(ints)
	fmt.Println(strings)
	fmt.Println(ints)

	// section: example
}
