I am an OCaml beginner so this question might be trivial. I have a few functions like this:
let rec
f1 <list of args> state = ...
and
f2 <list of args> state = ...
and
f3 <list of args> state = ...
and
f4 <list of args> state = ...
;;
Each of these functions call the other functions with the last argument as state. Therefore, for each execution 'tree', state is a kind of global read-only variable. How can I simulate this in a manner that state is abstracted out, yet the functions have access to it. Note that I don't want to use OCaml classes, a solution involving modules/submodules/functors would be nice!