Assignment 2: More OCaml
You are to write several OCaml functions, similar to what you had in assignment 1 but using more OCaml features. The instructions below are more or less identical to assignment 1.
- Use this zip file as the starting point for your assignment. Download and unzip it.
- The file
assignment2/src/assignment.mlis where you will put your answer code. Currently it hasunimplemented ()or similar for all the functions, replace that with your code. - The only other file you might want to edit is
assignment2/tests/tests.mlwhich contains some initial tests; you are welcome to add your own tests. - The terminal command
dune buildrun from the top levelassignment2/directory will build (compile) all your functions in theassignment.mlfile. - The terminal command
dune testalso run fromassignment2/will build the code and run all the tests in the abovetest.mlfile. It will report on each test whether it succeeded or failed. - To play with your code in
utop, you could copy/paste your functions directly into the top loop, but a perhaps easier way is to type terminal commanddune utop, again from theassignment2/directory. This will compile all your functions and load them intoutop. They will all be part of a moduleAssignmentsince the file was calledassignment.ml; so, next typeopen Assignment;;intoutopso the functions will be directly available. - When you are all done the homework, from directory
assignment2/run the commanddune buildone last time which will build_build/default/src/submission.zip– that is the zip file you should upload to Gradescope.
Submission and Grading
- This follows HW1: when prompted by Gradescope, upload your
_build/default/src/submission.zipfile generated bydune build. - As with assignment 1 there will be additional tests we run which you will not see the output of. Also we will be manually checking to make sure your code meets the specification.