Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
(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 itStep 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