Question: Write the following ML functions. On top of your code Include 3 line comment with your name, purpose and date. Precede each function by a

 Write the following ML functions. On top of your code Include

Write the following ML functions. On top of your code Include 3 line comment with your name, purpose and date. Precede each function by a one line comment including exercise number. Save your code as chapter5.txt and submit it by canvas. 1. (6p) Function square of type real real that returns the square of its parameter. For example square 4.0 should return 16.0. 2. (6p) Function max3 of type int int int int that returns the largest of three integers. For example max3(3,11,7) should return 11. 3. (6p) Function cubesum of type int int that takes a nonnegative integer n and returns the sum of cubes of all the ntegers 0 through n. Your function should return 0 if the parameter is negative. For example cubesum 4 should return 100. 4. (6p) Function power of type real int real that raises a real number to an integer power. For example power (3.0,4) should return 81.0 and power (2.0,2) should return 0.25 5. (6p) Function min of type int list int that returns the smallest element of a list of integers. Your function need not oehave well if the list is empty For example min[3,5,17,8,9,3] should return 8. 6. (6p) Function fourth of type 'a list 'a that returns the fourth element of a given list. You may assume that the list nas at least 4 elements. For example: fourth [1,5,9,2,7,8] should return 2

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!