Description
CSCI 461 Project Four focuses on defining custom data types and implementing recursive functions in Standard ML (SML). The project explores parameterized type constructors, data constructors, recursive datatype definitions, and list manipulation. Students create a custom mylist type and develop functions for calculating integer products, appending lists, and reversing list elements.
Assignment Description
Objectives:
• Write data constructor with parameters
• Write type constructor with parameters
• Write recursively defined type constructors
Problem Description:
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.
Solution Overview
The solution addresses defining a recursive, parameterized mylist datatype in Standard ML and implementing three functions: prod for multiplying integer elements, append for combining two custom lists, and reverse for reversing element order. It also covers recursive constructors and infixr declarations.


