Question: Complete below functions in Ocaml: let rec filter (f : 'a->bool) (l : 'a list) : 'a list = (* TODO, replace l *) l

Complete below functions in Ocaml:

let rec filter (f : 'a->bool) (l : 'a list) : 'a list = (* TODO, replace l *) l

-

let rec fold_left (f: 'y ->'x->'y) (y:'y) (l:'x list) : 'y = (* TODO, replace y *) y

let rec fold_right (f : 'x->'y->'y) (y:'y) (l:'x list) : 'y = (* TODO, replace y *) y

-

(* Concatenate a list of lists. *) let flatten (l : 'a list list) : 'a list = (* TODO, replace [] *) []

-

(* Insert elt into sorted list l in sorted order *) let rec insert (cmp : 'a->'a->bool) (elt :'a) (l:'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!