Question: 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 1[1,2,3,1,2] will return 2 since 1 has 2 occurrences in the list. occurs 3[1,2,3,1,2] will return 1 and occurs 4[1,2,3,1,2] will return 0.
occurs -[]=0
occurs a (x:x5)=1 et rest=occurs a xs
in if a==x 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 t the calls return the corressponding values:
occurst 1t6
occurst 2t2
occurst 3t1
occurst 4t0
data Tree a = Node (a, Tree a, Tree a) I Empty deriving Show
occurst - Empty =0
occurst a (Node , left, right
 a) Complete the following function to return number of occurences of

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!