Question: Please finish the below function with the given functions in Ocaml: Given: et rec fold_left (f: 'y ->'x->'y) (y:'y) (l:'x list) : 'y = match

Please finish the below function with the given functions in Ocaml:

Given:

et rec fold_left (f: 'y ->'x->'y) (y:'y) (l:'x list) : 'y =

match l with

[] -> y

| a::b -> fold_left f (f y a) b

-

let rec fold_right (f : 'x->'y->'y) (y:'y) (l:'x list) : 'y =

match l with

[] -> y

| a::y' -> f a (fold_right f y y')

Do:

(* Partion list l around elt. Return a tuple consisting of all elements before elt and all elements after elt. *) let pivot (cmp : 'a->'a->bool) (elt :'a) (l:'a list) : 'a list * 'a list = (* TODO, replace ([],[]) *) ([], [])

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!