Question: 1) a)Write the function mapreduce in CAML light, where the function mapreduce f op u x takes a function f, binary operation op, value u

 1) a)Write the function mapreduce in CAML light, where the function

1) a)Write the function mapreduce in CAML light, where the function mapreduce f op u x takes a function f, binary operation op, value u and list x=[x1, ;xn] and returns the value uf(x1) ef(xn), where x y = (op x y). The function should be tail recursive and should be caluculated from left to right. Show the following: let inc x = x+1 mul x y = x*y in mapreduce inc mul 1 [01:2:3 4]; b) Write a function maptwice in CAML that takes a function as a subject and returns a function that takes a list as a subject, which returns their list of values when the subject in the function mapftwice is applied twice in a row on each item in the list. So if the subject is a function g, apply gg to each element of the list. For example: let inc x= X+1 in let f= mapftwice inc in f [1:2;3 should give the list [3:4;5] Please write the full code and take a screenshot of the code 1) a)Write the function mapreduce in CAML light, where the function mapreduce f op u x takes a function f, binary operation op, value u and list x=[x1, ;xn] and returns the value uf(x1) ef(xn), where x y = (op x y). The function should be tail recursive and should be caluculated from left to right. Show the following: let inc x = x+1 mul x y = x*y in mapreduce inc mul 1 [01:2:3 4]; b) Write a function maptwice in CAML that takes a function as a subject and returns a function that takes a list as a subject, which returns their list of values when the subject in the function mapftwice is applied twice in a row on each item in the list. So if the subject is a function g, apply gg to each element of the list. For example: let inc x= X+1 in let f= mapftwice inc in f [1:2;3 should give the list [3:4;5] Please write the full code and take a screenshot of the code

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!