Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions