假设我正在编写矩阵模块
module type MAT =
sig
type dtypes
type 'a vec
type mat
val nan : dtypes
val make : rows:int -> cols:int -> mat
val copy_col : mat -> int -> dtypes vec
val write_col : dtypes vec -> mat -> int -> unit
val row : mat -> int -> dtypes vec
end;;
Run Code Online (Sandbox Code Playgroud)
具体实施
module MyMat(C:CONSTRAINTS) : (MAT with type dtypes = C.dtypes) =
struct
type dtypes = C.dtypes
type 'a vec = 'a array
type mat = …Run Code Online (Sandbox Code Playgroud) 我已经为一个模块实现了一个漂亮的打印机。目前我启动utop,加载依赖项然后做漂亮的打印机#install_printer pp_custom;;在哪里pp_custom。
我想自动执行此操作,以便我可以以类似于lacaml默认情况下“安装”矩阵的漂亮打印机的库的方式拥有它。
我该怎么做呢?
ocaml ×2