Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个接受命令行参数的程序。与源文件相同的是encode.ml。我想在顶层加载这个文件。
有没有办法在顶层加载源文件,我们可以将它传递给命令行参数?
谢谢。
是的,用 . 调用你的顶层ocaml encode.ml arg1 arg2 etc。下面的程序演示了它:
ocaml encode.ml arg1 arg2 etc
$ cat args.ml let () = Array.iteri (Printf.printf "%d -> %s\n") Sys.argv $ ocaml args.ml -h --help -help 0 -> args.ml 1 -> -h 2 -> --help 3 -> -help