小编ayc*_*ycc的帖子

OCaml:暴露抽象类型的替代方法

假设我正在编写矩阵模块

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)

ocaml

3
推荐指数
1
解决办法
329
查看次数

OCaml:自动安装自定义漂亮打印机

我已经为一个模块实现了一个漂亮的打印机。目前我启动utop,加载依赖项然后做漂亮的打印机#install_printer pp_custom;;在哪里pp_custom

我想自动执行此操作,以便我可以以类似于lacaml默认情况下“安装”矩阵的漂亮打印机的库的方式拥有它。

我该怎么做呢?

ocaml

1
推荐指数
1
解决办法
712
查看次数

标签 统计

ocaml ×2