(CSCI 421 VA) Project Four Define Type and Write Functions to Handle the Type

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

The student shall turn in definition of mylist and three functions to handle mylist. In
YourNameProjFour.sml file, the student needs to write the following type and
functions
1. Define mylist type that is the same as the one on page 172 of the textbook.
2. Define a function prod that returns the product of all integers in a mylist of
integers. (refer to problem Exercise 6 on page 178)
3. Write a function append of type ‘a mylist -> ‘a mylist -> ‘a mylist that takes
two mylist values, a and b, and return a mylist contains all the values in a
followed by all the values in b. (refer to Exercise 8 on page 178)
4. Write a function reverse of type ‘a list -> ‘a list that takes a mylist x and
return a mylist of all elements of x, in a reverse order. (refer to Exercise 7on
page 178)
Sample Run:
Please see the screen shot on next page. Please notice how infixr 5 is used. (Refer to
examples on page 174). Also please notice that the result list may not fully
displayed. For instance, for list with element 1, 2, 3, 4, 5, it may only display as 1
CONS 2 CONS 3 CONS # CONS #
Due Date:
The file needs to be submitted through blackboard link on time. The file name
should be YourNameProjFour.sml. Due date will be announced on blackboard.