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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!