I am attempting to make a function such that it outputs a list that removes adjacent duplicates
let rec rem_adj_duplicates l =
let rec utn l n = match l with
[] -> n
| (x :: y :: xs) -> if (x != y) then utn (y::xs) (n::x)
else utn (y::xs) n
in utn l []
I get the following error:
Error: This expression has type 'a list but an expression was expected of type 'a The type variable 'a occurs inside 'a list
Why does n want to be type 'a instead of 'a list?