Problem 8

(Intermediate 🌟🌟) Eliminate consecutive duplicates of list elements.

variable {α : Type} [BEq α]

def compress (l : List α) : List α :=
  sorry

-- The following codes are for test and you should not edit these.

example : compress [1, 1, 2, 2, 1, 2, 2] = [1, 2, 1, 2] := by rfl

example : compress ([] : List α) = [] := by rfl

example : compress ['C', 'o', 'o', 'o', 'p', 'y', 'y'] = ['C', 'o', 'p', 'y'] := by rfl