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
Get step-by-step solutions from verified subject matter experts
