Question: Use ML patterns to write a function intersection ( S 1 , S 2 ) that returns the intersection of sets S 1 and S

Use ML patterns to write a function intersection (S1, S2) that returns the
intersection of sets S1 and S2. Hint: use/call the function member from Q1 to check whether an element belongs to a set or not.
I used this function member code for Q1:
fun member(e,L)=
if null L
then false
else if e= hd(L)
then true
else member(e,tl(L));

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 Programming Questions!