Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedSML 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 2

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago