创建 OCAML 函数来输出代码文件?

Creating an OCAML function to output a code file?

我想创建一个函数来使用 OCAML 输出代码文件(如果可能的话,希望输出 C++ 文件)。

有没有办法轻松做到这一点,或者使用 open_out 函数提供写入输出文件的代码是唯一可行的方法?

谢谢

您还可以使用 Core

中的 Out_channel

https://dev.realworldocaml.org/imperative-programming.html