Question: Using Standard ML functional programming: (a) Write a polymorphic function that takes a list as a parameter and splits it into two lists and returns

Using Standard ML functional programming:

Using Standard ML functional programming: (a) Write a polymorphic function that takes

(a) Write a polymorphic function that takes a list as a parameter and splits it into two lists and returns them as a tuple. Elements in odd positions are returned in the first list. Elements in even positions are returned in the second list. Example: split [3,9,10,2,5] returns ([3,10,5], [9,2]). Hint: use induction to find a solu- tion to the problem, then code it. (a) Write a polymorphic function that takes a list as a parameter and splits it into two lists and returns them as a tuple. Elements in odd positions are returned in the first list. Elements in even positions are returned in the second list. Example: split [3,9,10,2,5] returns ([3,10,5], [9,2]). Hint: use induction to find a solu- tion to the problem, then code it

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!