Answered step by step
Verified Expert Solution
Question
1 Approved Answer
8. (15) (a) What is the type of the following unknown9 function? Give the most general type and include any required class constraints. The function
8. (15) (a) What is the type of the following unknown9 function? Give the most general type and include any required class constraints. The function length returns type Int.
> unknown9 [] = [] > unknown9 (x:xs) = (a , x) : b > where > a = length $ x : takeWhile (==x) xs > b = unknown9 (dropWhile (==x) xs)
(b) Give a description of what the unknown9 function in part (a) does. Describe what it does, not how it works.
(c) Give a non-trivial test case for the unknown8 function in part (a) and show the expected results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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