例如,我想将下列文件动态加载到我的程序中并打印出结果。 input1.txt - >打印100 let x = 10 in x * x
input2.txt - >打印3 let x = 1 and y = 2 in x + y
input3.txt - >打印4 let ls = [1;2;3;4] in List.length ls
ocaml_plugin可能对这个项目有用。我想
我是一个初学者自学OCaml与真实世界OCaml。 出于某种原因,线 let contains_1 l =
if List.mem l 1 then true;;
抛出错误 错误:此表达具有等于输入:(INT - > INT - > BOOL) - > BOOL但预期的表达类型布尔 这个例子似乎非常简单,我不知道是怎么回事。好像List.mem l 1没有评估,只是坐在那里作为一个功
我正在按照OCaml的入门指南和我正在开发的一个程序不工作,我想知道是否可以解释为什么。 let profit_500 : int =
let price = 500 in
let attendees = 120 in
let revenue = price * attendees in
let cost = 18000 + 4 * attendees in
1)假设有一个模块 module Int_Sig_1 =
struct
let x = 1
end
;;
2)和该模块 module type INT_SIG =
sig
val x:int
end
;;
3)的显式签名和我创建基于第一级模块在上面的模块和模块类型 let int_sig_1 = (module Int_Sig_1:INT_SIG)
4)现在我创建另一个
我有一个ocaml的问题早解决,但我不知道是否有优化我的解决方案最好的办法,因为我已经尝试了所有的渠道,因为我很新的ocaml的我真的不能看着办吧出。我有一个模式功能,可以很好地打印,然后再添加一组功能。漂亮的打印功能如下: let rec processoperatorchange fmt = function
| Zero -> Format.fprintf fmt "0"
| Pproc
1)I有这种模块型 module type MOD_SIG = sig type t val min val max;;
2)I创建基于上述 module MOD_UINT8 = struct
type t = int32
let min = Int32.of_int 0
let max = Int32.of_int 255 end;;
module MOD_
1)我有一个签名 module type UINTSIG=
sig
type t
val create: t->t
end
2)我想创建一个使用上面的签名两个模块 所以我非常希望保持签名1 ,在一个单独的文件中,使用1中签名的模块的实现和签名文件。 我的问题是 A)我应该在哪里将签名放在上面1中。我应该把它放在uintsig.mli文件中吗? B)如何在.mli/ml文件中表示他们在1