Remove consecutive duplicates based on a custom equality rule
slices.CompactFunc( []int{1, 1, 2}, func(a, b int) bool { return a == b }, )