This is a school assignment, but everything that I am going to publish is done only by me and me. Therefore, I only demand your help for a tiny step in my assignment, in which I am stuck.
let rec removeDuplicates2 xs = match xs with |[]->[] |y::ys -> if y = (List.exists y ys) then (removeDuplicates2 ys) else y::(removeDuplicates2 ys) printfn "%A" (removeDuplicates2 [3;1;3;2;1]) // result must be [3;1;2]
For what help is needed, the if statement is called, which checks whether the element y is a member of the list ys
at the moment I get an error: "This expression should have been of type '' a → bool 'but there is a type of' BOOL 'here"
can someone tell me what i am doing wrong?
list exists if-statement f # elements
Nulle
source share