Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a ) Complete the following function to return number of occurences of the first parameter in the second parameter list. occurs 1 [ 1 ,
a Complete the following function to return number of occurences of the first parameter in the second parameter list. occurs will return since has occurrences in the list. occurs will return and occurs will return
occurs
occurs a : et restoccurs a
in if then
else
b Complete the following function to return number of occurences of the first parameter in the nodes of the second parameter tree. The definition of tree is given below. In the sample tree the calls return the corressponding values:
occurst
occurst
occurst
occurst
data Tree a Node a Tree a Tree a I Empty deriving Show
occurst Empty
occurst a Node left, right
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