0
votes

I'm working on a function for class, and I am getting this error.

Error: operator and operand don't agree [tycon mismatch]

operator domain: 'Z list

operand: 'Y list -> 'Y list

in expression: null tl

fun removedub(L) =
  if (null L) then nil
  else if (null tl(L)) then hd(L)
  else if hd(L) = hd(tl(L)) then removedub(tl(L))
  else hd(L) :: removedub(tl(L));



val list = ["a", "a", "b", "b", "c"];

removedub(list);

I'm not sure how to fix this, or really what is causing it, any tips?

1

1 Answers

0
votes

You set the parentheses wrong. When you write

null tl(L)

then that has the same meaning as

null(tl)(L)

However, you want

null(tl(L))