Question: OCaml Programming: (Do not use List module or other library functions) diff: 'a list -> 'a list -> 'a list diff a b returns the
OCaml Programming: (Do not use List module or other library functions) diff: 'a list -> 'a list -> 'a list
diff a b returns the difference of sets a and b in a. For example, eq (diff [1;3;2] [2;3]) [1] = true.
In [ ]:
let rec diff a b = (* YOUR CODE HERE *)
In [ ]:
assert (eq (diff [1;3;2] [2;3]) [1]); assert (eq (diff ['a';'b';'c';'d'] ['a';'e';'i';'o';'u']) ['b';'c';'d']); assert (eq (diff ["hello";"ocaml"] ["hi";"python"]) ["hello";"ocaml"]);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
