我根据Real World OCaml's安装说明更新了.ocamlinit
以使用以下设置:
#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;
运行utop
工作正常,只是在开头产生一些额外的输出,但是ocaml
会产生大量的启动消息:
/usr/lib/ocaml/threads: added to search path
/usr/lib/ocaml/unix.cma: loaded
/usr/lib/ocaml/threads/threads.cma: loaded
/usr/lib/ocaml/dynlink.cma: loaded
/usr/lib/ocaml/camlp4: added to search path
/usr/lib/ocaml/camlp4/camlp4o.cma: loaded
/usr/lib/ocaml/bigarray.cma: loaded
... (And so on, for ~50 lines or so!)
/home/jmu303/.opam/system/lib/herelib/pa_herelib.cma: loaded
#
我可以抑制这些启动消息吗?
答案 0 :(得分:1)
一种方法是告诉你以前没有进入交互式环境:
# Sys.interactive := false;
# #use "topfind";;
# Sys.interactive := true;
您可以看到Batteries toplevel初始化代码,以获取此方法的示例:https://github.com/ocaml-batteries-team/batteries-included/blob/master/ocamlinit