Question: Write a function ap: ('a'b) list> 'a list -> 'b list ap fs args applies each function in fs to each argument in args

Write a function ap: ('a'b) list> 'a list -> 'b list ap fs args applies each function in fs to each argument

Write a function ap: ('a'b) list> 'a list -> 'b list ap fs args applies each function in fs to each argument in args in order. For example, ap [(fun x -> x^"?"); (fun x -> x^"!")] ["foo"; "bar"]= ["foo?"; "bar?" ; "foo!"; "bar!"] where is an OCaml operator for string concatenation. let ap fs args = (* YOUR CODE HERE *) assert (ap (fun x -> x^"?"); (fun x - x^!")] ["foo"; "bar"]= ["foo?"; "bar?"; "foo!"; "bar!"]);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an OCaml function ap that takes a list of functions fs ... View full answer

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 Programming Questions!