Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started