Introduction to OCAML.
You may need to refer to the Pervasives module documentation occasionally. All the functions there are available in OCAML by default. You are NOT allowed to use everything that’s there unless we have talked about it or unless the assignment question asks you to look it up.
In this assignment you are asked to implement 9 functions. Each function is worth one point, and the assignment has an extra point for “style”, for a total of 10 points.
The assignment expects you to use GitHub and Git to keep track of your work. The first couple of steps below will get you set up.
yourAccountHere
.https://github.com/skiadas/ProgLangAssignments.git
. It will have “HTTP” to its left. Click in that textbox and copy that whole text to the clipboard.git clone <pasteThatLinkHere>
.subl .
to do that.git add .
This “prepares” your changes for committing.git status
This should show you two files ready for commit.git commit -m "My first commit!"
This creates a commitgit push
This should upload your changes to GitHub.assignment1sub.ml
This is the main submission file. It is where you will add your code for the various functions that you need to write. There are comments in that file to show you where to add your function definitions, and to tell you what your functions should do.assignment1tests.ml
This is a file with a small number of tests, and you should add plenty tests your own. “Tests” are arranged as lines let ... = e
where e
is a an expression that is meant to evaluate to a boolean indicating if the tests succeeded or not.utop
, do:#use "assignment1sub.ml";;
#use "assignment1tests.ml";;
You should be able to use auto-completion. - The first #use
should print for you the type signatures for all the functions you had to write. Make sure this matches the signatures described in the code file. - The second #use
should print a bunch of true
values out, for all the existing tests along with all the tests you added.