OCaml

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(指南)
(指南)
第14行: 第14行:
 
==指南==
 
==指南==
 
完成第一个OCaml程序,Hello World!,创建test.ml文件,包含:  
 
完成第一个OCaml程序,Hello World!,创建test.ml文件,包含:  
  let _=print_endline "hello world!" // Byte-code编译
+
  let _=print_endline "hello world!"  
  或 ocamlopt test.ml -0 test         // Native-code编译
+
  编译 test.ml
编译 test.ml
+
ocamlc test.ml -o test // Byte-code编译
  ocamlc test.ml -o test
+
  或 ocamlopt test.ml -o test // Native-code编译
 
   ./test
 
   ./test
 +
 +
REPL
 +
$ ocmal 或 $ utop
  
 
==常见问题==
 
==常见问题==

2016年9月19日 (一) 02:23的版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 OCaml Thanks, Wikipedia.

OCaml,最早称为Objective Caml,是Caml编程语言的主要实现,由Xavier Leroy,Jérôme Vouillon,Damien Doligez,Didier Rémy及其他人于1996年创立,OCaml是开放源代码项目。

OCaml一般用于编译器、程序分析、金融交易、虚拟机等方面。它是Jane Street的核心语言,重点是用它写实时交易系统会很赚钱。

F#,Microsoft .NET平台上 OCaml 风格的编程语言。

OCaml-Logo.png

目录

Windows

指南

完成第一个OCaml程序,Hello World!,创建test.ml文件,包含:

let _=print_endline "hello world!" 
编译 test.ml
ocamlc test.ml -o test  // Byte-code编译
或 ocamlopt test.ml -o test // Native-code编译
 ./test

REPL

$ ocmal 或 $ utop

常见问题

Error: Unbound module Core

vim ~/.ocamlinit 加入以下内容,并重新运行utop

#use "topfind"
#camlp4o
#thread
#require "core.top"
#require "core.syntax"

项目

Facebook也发布了一些OCaml开源项目

  • flow Adds static typing to JavaScript to improve developer productivity and code quality.
  • Reason: Build Systems Rapidly
  • Infer is a static analysis tool for Java, Objective-C and C, written in OCaml.
  • pfff Tools for code analysis, visualizations, or style-preserving source transformation.

课程

书籍

开发者

用户

更多用户成功故事

图集

链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱