Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Kindly solve it in SML programming language. 1. Write a recursive ML function using pattern matching with name/type fill:intintintintlist that inputs an integer x, an

Kindly solve it in SML programming language.

image text in transcribed

1. Write a recursive ML function using pattern matching with name/type fill:intintintintlist that inputs an integer x, an integer s, and a non-negative integer n. It will return the list [x,x+s, x+2s,x+3s,,x+(n1)s] where the list starts with the value x and then each successive value adds s to the previous value until there are n values in the list. (You may assume valid inputs.) For example, - fill (1,3,7); val it =[1,4,7,10,13,16,19] : int list - fill (0,10,5); val it =[0,10,20,30,40] : int list 2. Write an ML accumulation function with name and type h:intintint that will be used with one of the reduce functions so that it will return the largest integer in a list of positive integers. For example: -foldlh?[2,8,5,1,7,6];valit=8:int In addition to submitting the code for h, submit the test case above with an appropriate initial value to demonstrate that your accumulation function produces the correct

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

Google Analytics 4 The Data Driven Marketing Revolution

Authors: Galen Poll

2024th Edition

B0CRK92F5F, 979-8873956234

More Books

Students also viewed these Databases questions

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago