To save the table in a separate file (for example, as an array), simply create a file strings.mlwith the contents:
let tbl = [|
"String 0";
"String 1";
"String 2";
...7000 more...
|]
Compile this with:
ocamlc -c strings.ml
As explained in manual , this defines a module Stringsthat can be referenced by other Ocaml modules. For example, you can run a top-level file:
ocaml strings.cmo
And find the line by accessing a specific position in the array:
Strings.tbl.(1234) ;;
source
share