Assignment 3 (pdf)

Type variants

In this assignment we explore type variants. You will implement a number of functions related to the game Rock-Paper-Scissors. You should read through the extensive file at the beginning of the assignment file, as well as the type definitions that follow it. For this assignment only, specify both the argument types of the functions as well as their returns types like so:

let f (x : t1) : t2 = ...

As in prior assignments, you should not use any functions we have not learned about. These assignments are not about learning a number of library functions, but about delving deeply into fundamental building blocks of programming.

Correctness of the solutions, including the types and whether the code loads, will count for 15 points. Your code MUST load with no errors and have the correct types. Otherwise you will receive 0 for correctness even if most of your functions are correct.

Another 5 points will come from style issues, your tests and use of GitHub. You should create a GitHub issue for each “atomic” task that you have to deal with. For instance, creating tests for a specific function, implementing a specific function, polishing up a specific function, identifying an incorrect behavior in a function and writing a test for it, then fixing it, are all distinct issues.

  1. You already have created a link to the instructor’s remote repository. You need to download the updated version of the instructor’s repository and merge the changes into yours. The following should do that:
  2. Throughout your work, create and close issues as described in the instructions above as well as in homework 2.
  3. You will find two files in this directory:
  4. To “run” your tests, start an OCAML session in the terminal via utop, do:

    #use "assignment3sub.ml";;
    #use "assignment3tests.ml";;