Starting from:

$30

Project One My First ML Project

(CSCI 461 VA) Project One My First ML Project
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
https://www.youtube.com/watch?v=hDkG2aH2iqU
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.

More products