当我在utop中键入#require "时,每次在"之后键入额外的字符时都会收到此消息。 [WARNING] cannot read directory /usr/lib/ocaml/METAS: No such file or directory 包导入似乎不起作用。我尝试通过opam重新安装utop,但错误仍然存在。有谁知道可能出了什么问题吗?
在一个新的Debian系统(挤压/Sid)上,我使用apt安装了以下软件包:
ocaml-batteries-includedlibpcre-ocaml-devlibcamlnet-ssl-ocaml-devlibldap-ocaml-dev
在编译代码时,我会得到以下错误:
ocamlfind: [WARNING] The DLL dllnetaccel_c.so occurs in multiple directories: /usr/lib/ocaml/stublibs
ocamlfind: [WARNING] The DLL dllnetaccel_c.so occurs in mul
我正试着通过真实世界的OCaml这本书来学习OCaml。他们有一个指南,我应该按照这个指南来安装Core包和utop。然而,虽然我似乎可以使用Opam成功地安装这两个工具,但当我尝试使用它们时,它们都不起作用。
我知道它们已安装,因为当我再次尝试安装它们时,会收到以下消息:
$ opam install utop core
[NOTE] Package utop is already installed (current version is 1.10).
[NOTE] Package core is already installed (current version is 109.55.0
我在OCaml版本4.04的utop中定义了函数f。
utop # let f = function x -> x + 1;;
val f : int -> int = <fun>
当我试图忽略f时,我会遇到一个警告。
utop # let a = ignore (f : int -> int); f 2;;
Characters 15-19:
Warning 5: this function application is partial,
maybe some arg
Emacs 24和Mac小牛,我的emacs文件如下:
(setq debug-on-error t)
;; -- common-lisp compatibility if not added earlier in your .emacs
(require 'cl)
;; -- Tuareg mode -----------------------------------------
;; Add Tuareg to your search path
(add-to-list
'load-path
;; Change the path below to be wherev
我需要另一个我正在安装的软件包libusb。
我试过以下似乎安装了软件包的方法,
sudo apt-get install libusb-dev
但当我试图安装我得到的另一个软件包时,
configure: error: Package requirements (libusb-1.0 >= 0.9.1) were not met:
No package 'libusb-1.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in
我刚刚在openSUSE上安装了utop,但当我在终端中输入utop时,我会看到
If 'utop' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf utop
输入eval 'opam config env'会得到以下结果:
OPAM_SWITCH_PREFIX='/home/jadw1/.opam/default'; export OPAM_SWITCH_PREFIX;
CAML_LD_LIBRA
我习惯于在print_int中使用标准函数OCaml,但当我按照“真实世界”( Real )一书中的建议,打开简街的图书馆Base时,我会得到一个不推荐的警告:
utop # print_int;;
- : int -> unit = <fun>
utop # open Base;;
utop # print_int;;
Line 1, characters 0-9:
Alert deprecated: Base.print_int
- : int -> unit = <fun>
更糟糕的是,当我用dune构建它时,正如书中所建议的那样,警告变成了错误。我该
假设函数g定义如下。
utop # let g ~y ~x = x + y ;;
val g : y:int -> x:int -> int = <fun>
utop # g ~x:1 ;;
- : y:int -> int = <fun>
utop # g ~y:2 ;;
- : x:int -> int = <fun>
utop # g ~x:1 ~y:2 ;;
- : int = 3
utop # g ~y:2 ~x:1 ;;
- : int = 3
现在有了另一个函数foo
utop # let foobar (f: x:in
举一个源自RWOCaml的例子:
utop # let divide ~first ~second = first / second;;
val divide : first:int -> second:int -> int = <fun>
utop # let apply_to_tuple_3 f (first,second) = f second first;;
val apply_to_tuple_3 : ('a -> 'b -> 'c) -> 'b * 'a -> 'c = <fun
在网上搜索了很多之后,我从来没有看到过对以下问题的满意答案或解释。我想使用CocoAspell在OSX10.9( TexShop、TextMate等插件)上进行系统范围的拼写检查,但是每次安装它时,brew doctor都会发出以下警告:
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be del
我正在尝试从OCaml库中构建一个共享对象,我可以在Python下使用ctypes中的cdll接口运行该库。
是否有一种方法可以引导OCaml工具链中的某个东西生成一个共享对象,并将它的依赖项链接到?
我开始怀疑OCaml根本不支持我想要做的事情。我想调用一个OCaml函数,但是让它生成某种结果并将控制返回到调用它的位置。
这是我的OCaml库
(* foo.ml *)
let add x y = x + y
我用来在OS上编译它的命令(使用.so而不是.dylib稍微违背了平台的命名约定,但是ocamlopt只接受.o或.so的扩展)。
$ ocamlopt -output-obj -fPI
我是OCaml初学者,在MacOS上使用OCaml 4.12.0。这个let表达式:
let gg x y = (x -. y) < 5.0
在托普莱尔,结果是:
Error: This expression has type float but an expression was expected of type
int
显式添加类型信息等,没有解决问题。令人沮丧的是,我访问了在线REPL TryOCaml,该表达式没有错误地被接受,返回了以下类型的签名:
val f : float -> float -> bool = <fun>
如预期的
我目前使用的是R版本为3.6.3的macOS。 当我尝试安装ggm包时,出现如下警告。 Warning in install.packages :
dependency ‘graph’ is not available
also installing the dependency ‘igraph’ 然后,当它完成安装时,它似乎也无法工作: ERROR: compilation failed for package ‘igraph’
* removing ‘/usr/local/lib/R/3.6/site-library/igraph’
ERROR: dependencies ‘igra
考虑一下这个非常基本的模块定义:
module type My_test = sig
type config with sexp
end;;
当我在utop提示符上直接输入这个命令时,一切正常:
utop # module type My_test = sig
type config with sexp
end;;
module type My_test =
sig type config val config_of_sexp : Sexp.t -> config val sexp_of_config : config -> Sexp.t end
但是,当我试图#use一个