Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write in ocaml you should use todo functions In this question we want you to find the largest item in a list of integers. You

write in ocaml

you should use todo functions

  1. In this question we want you to find the largest item in a list of integers. You can assume that the lists are nonempty. The top level declaration is nonrecursive because there is an internal recursive function.

    # let find_max l = ... val find_max : 'a list -> 'a =  # find_max [1; 6; 3; 2; 6; 1; 7; 2; 3; 5];; - : int = 7

    Even though your code is polymorphic and should work on all types for which an order is defined (int, char, string) the grader will get confused if you try to give it a list containing items of different types. Please only test this on integer lists.

(* Q3 TODO: Write your own tests for the find_max function. *) let find_max_tests = [ (* Your test cases go here. *) ] (* (* Q3 TODO: Implement find_max. *) let find_max l = *)

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

Step: 3

blur-text-image

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