OCaml Higher Order Functions
Description
Complete the function definitions in the hof.ml and tree.ml files. In your
code, you may only use library functions found in the Stdlib
module and the
following functions from the List module: map, fold_left, and fold_right. You
may not use any imperative structures of OCaml such as references.
Instructions
To execute the test cases, run the following command:
dune runtest -f
To list the public test cases, run the command:
dune exec test/public.exe -- -list-test
To run a specific public test case, run the command:
dune exec test/public.exe -- -only-test <test case name>
To load all the function definitions into the OCaml top-level run the following commands within the top-level (REPL):
#use_output "dune ocaml top";;
open Project2.Hof;;
open Project2.Tree;;
The following are the relevant files for your code:
- OCaml Files
- src/hof.ml: Write your code in this file.
- src/tree.ml: Write your code in this file.
- test/student.ml: Write at least one additional test case for each unit in this file.
Turning in the Assignment
To submit your assignment, create a zip file of a DIRECTORY named
project2-handin containing ONLY the these files:
hof.mltree.mlstudent.ml
Then submit that file to the appropriate folder on D2L.
Grading Criteria
Grading (out of 52 points):
- 39 points — correctness
- 3 points per function implemented
- 13 points — test cases
- 1 point per function implemented
Academic Integrity
Please carefully read the Computer Science Academic Integrity Policy. Any evidence of impermissible cooperation on projects, use of disallowed materials or resources, or unauthorized use of computer accounts, will be considered academic dishonesty. Lack of knowledge of the policies will not be considered as a defense for violating them.