Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SML ONLY Write the following ML functions. On top of your code Include 3 line comment with your name, purpose and date. Precede each function
SML ONLY
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 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started