我是绝对的OCaml初学者。我想创建一个重复20次字符的函数。 这是功能,但由于错误而无法使用。 let string20 s =
let n = 20 in
s^string20 s (n - 1);;
string20 "u";;
我想这样 # string20 "u"
- : string = "uuuuuuuuuuuuuuuuuuuu"
有没有可能使用ppx扩展或类似方法将功能更新语法{ record with key = value }与嵌套记录一起使用的方法? 例如,在下面的示例程序中,我在功能上只更新最外层的记录,当我真的想要定位一个“内层”记录时。 type outer = {
a : float;
b : inner
}
and inner = {
c : float;
}
let
试图与OCaml的开发上Arch Linux的4.12.10,我一直运行到该错误消息: ### stderr ###
# error: executing gringo failed (No such file or directory)
# error: gringo returned with non-zero exit status
[ERROR] External solver f
是否有可能在没有创建“必须实现的新模块”的情况下在mli中模块化。 这个例子很有意思,但是,假设我有以下源文件int_wrapper.ml。 type t = Int64.t
let zero = Int64.of_string "0"
我想为它定义一个接口文件,但Int64.t很长,所以我想缩写它。 module I = Int64
val zero : int -> I.t
当