Description
CSCI 461 Project One, My First ML Project, introduces functional programming using Standard ML of New Jersey (SML/NJ). The assignment focuses on installing and using the interactive SML environment, defining functions, integer arithmetic, list processing, and testing program correctness. Students implement cube, sqsum, and max functions while learning to execute Standard ML source files.
Assignment Description
Objectives:
1. Install Standard ML of New Jersey to your computer
2. Write/Run SML functions on Standard ML of New Jersey Interactive System
3. Write the SML functions in a text editor, then run the code on Standard ML of
New Jersey Interactive System
Functions to Write:
1. Write a function cube of type int ! int that returns the cube of its parameter
2. Write a function sqsum of type int ! int that takes an non-negative integer n
and returns the sum of the squares of all the integers 0 through n. Your
function need not behave well on negative input.
3. Write a function max of type int list ! int that returns the largest element of
a list of integers. Your function need not behave well if the list is empty.
(refer to exercise 13 on page 85 of the textbook)
Steps to Finish the Project:
Step One: Install Standard ML of New Jersey to your computer.
To install on Window, please watch the video
To install on Mac, you may watch the video at https://youtu.be/qdUnCK85CoI
Step Two: Write all functions in a text editor and save the file as
YourNameProjOne.sml.
Step Three: Run your code and test the correctness with data
Open terminal window. Use command ls see the folders/files in current folder. Use
command cd .. to go into upper level folder. Use command cd folder_name to go to
the subfolder. Navigate to the folder where you saved YourNameProjOne.sml file.
Now type command: sml
Then type command: use “YourNameProjectOne.sml”
The file name must be in “ “. If everything is correct, your functions are ready to use.
Sample Run on My Computer: my file was saved as CSCI461ProjOne.sml in folder
Documents/CSCI461VA/Project. The file name is: CSCI461ProjOne.sml. It contains
the following code:
(* this is problem one *)
fun cube x = x*x*x;
(* this is problem two *)
fun cube2 x:real = x*x*x;
Here (* … *) are comments
Here is the screen shot for what I have done:
The due date will be announced on Blackboard.
Solution Overview
The solution addresses three Standard ML functions: cube for integer cubing, sqsum for summing squared integers from zero through a specified value, and max for finding the largest integer in a list. It also covers loading and testing functions in SML/NJ.

