OCaml

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(简介)
(书籍)
第106行: 第106行:
 
*[https://www.amazon.cn/gp/product/B013W98L4C Real World OCaml] [https://realworldocaml.org/ 在线阅读]
 
*[https://www.amazon.cn/gp/product/B013W98L4C Real World OCaml] [https://realworldocaml.org/ 在线阅读]
 
*[http://book.huihoo.com/developing-applications-with-objective-caml/ Developing applications with Objective Caml]
 
*[http://book.huihoo.com/developing-applications-with-objective-caml/ Developing applications with Objective Caml]
 +
*[https://www.amazon.com/gp/product/3030976440 OCaml Scientific Computing]
 +
*[https://www.amazon.com/gp/product/0957671113 More OCaml: Algorithms, Methods & Diversions]
  
 
==开发==
 
==开发==

2022年9月26日 (一) 10:58的版本

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

OCaml

OCaml-Logo.png

目录

简介

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

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

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

ML 家族的两个主要的方言是 Standard ML 和 OCaml。

Windows

指南

OCamlverse Documenting everything about OCaml

完成第一个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 // eval $(opam config env)
 utop # let () = print_endline "Hello OCaml World!";;
 Hello OCaml World!  

类型

 utop # (1, "str1", 2.);; // 元组tuple
- : int * string * float = (1, "str1", 2.)     
 utop # [1; 2; 3];; // 列表list
- : int list = [1; 2; 3]  
 utop # [|1; 2; 3|];; 数组array
- : int array = [|1; 2; 3|]   
 utop # type vec2 = { x : float; y : float };; //记录record
type vec2 = { x : float; y : float; }

常见问题

Error: Unbound module Core

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

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

-bash: ocamlfind: command not found

eval $(opam config env)

项目

Awesome OCaml Awesome.png

Jane Street 开源的 Ocaml 项目

Facebook 开源的 OCaml 项目

  • Hack is a programming language for HHVM
  • 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.

课程

文档

书籍

开发

用户

更多用户成功故事

图集

链接

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

变换
操作
导航
工具箱