Using Str module in OCaml top level?

喜你入骨 提交于 2019-12-07 18:07:07

问题


I tried two commands to load Str Module in OCaml top level. The first command gives me the error "Cannot find file Str.cmo". I then tried to use the file i was using in top level with the second command. With that command i got "Reference to undefined global Str".

#load "Str.cmo";;

#use "my_file.ml";;

What do i need to do to successfully load Str module in OCaml top level.


回答1:


Modules are "archives", so they are .cma files, not .cmo:

# #load "str.cma";;
# Str.regexp;;
- : string -> Str.regexp = <fun>



回答2:


# #use "topfind"
# #require "str"


来源:https://stackoverflow.com/questions/37513046/using-str-module-in-ocaml-top-level

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!