Question: (i) Code in SML a function removeFirst 'a'a list -'a list that removes from the given list the first occurrence of the given value (if

 (i) Code in SML a function removeFirst 'a'a list -'a list

(i) Code in SML a function removeFirst 'a'a list -'a list that removes from the given list the first occurrence of the given value (if it occurs there at all), but keeps all later occurrences removeFirst 5 [1,5,3,4,3,5,5,7]; val it- [1,3,4,3,5,5,7] : int list (ii) Code a function remove : ,a-> , a list-> ,a list that rem oves from the given list all occurrences of the given value - remove 5 [1,5,3,4,3,5,5,7] val it - [1,3,4,3,7] : int list (iii) Use remove to code a function nub : , , a list ' a list that makes the given list duplicate- free by keeping only the first occurrence of each value in the list. - nub [1,5,3,4,3,5,5,7]; val t = [1 ,5 , 3, 4, 3,7] : int list

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!