How do I pattern match on the list with two elements?
noDupes : List a -> List a
noDupes list =
case list of
[] -> []
x::y ->
if x == y then
x :: list
else
x :: y :: list
x::y::xs ->
if x == y then
x :: noDupes xs
else
x :: (noDupes y::xs)
And in the case of two element how do you add that to the rest of the list? As you can see I use "list" in the second case. I don't think it's correct.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
How do I pattern match on the list with two elements?
And in the case of two element how do you add that to the rest of the list? As you can see I use "list" in the second case. I don't think it's correct.