Compact

Removes consecutive duplicate elements from the slice.


slices.Compact([]int{1, 1, 2, 2})
                        
introduction.go