Functional programming is awesome, or so we believe, and in the beginning we’re going to ask you to quit “cold turkey” on imperative programming. That means not using any of OCaml’s imperative features. Here is the short list of prohibited features:
- The built-in imperative data types: refs, arrays, and mutable fields.
- The deprecated functions in the
If you do use any of those features, your submission will receive a substantial penalty. The amount will depend on the degree of your violation, but could be around 25% on the entire assignment. We happily will reduce the penalty to be quite small if you then submit a revised assignment that eliminates use of the prohibited features.
About halfway through the semester, we will flip the switch and allow all those features.
On the other hand, these features are always explicitly permitted:
- Input and output, to the console or to files, is permitted even though it has side effects.
- Loops are not inherently imperative hence are permitted. But most of the time they are useless in the absence of other imperative features.
If you have questions about whether any other features should be on either of these lists, please ask.