Welcome to a World of OCaml (original) (raw)

An industrial-strength functional programming language with an emphasis on expressiveness and safety

`# let square x = x * x val square : int -> int = < fun >

square 3

- : int = 9

let rec fac x =

if x <= 1 then 1 else x * fac (x - 1) val fac : int -> int = < fun >

fac 5

- : int = 120

square 120

- : int = 14400`

Try the Playground

illustration of a cup

The OCaml Compiler has been recognised by SIGPLAN for their prestigious Programming Languages Software Award

Fourteen core OCaml developers are featured for their significant contributions to the project

Trusted by Industry Leaders

These companies and organisations rely on OCaml every day — along with thousands of other developers. See Success Stories

Why OCaml?

RELIABILITY

Powerful Type Safety Made Simple

OCaml’s lightweight but highly expressive type system catches more bugs at compile time while garbage collection allows you to focus on application logic instead of memory management. Large, complex codebases become easy to maintain and refactor. OCaml empowers you to create mission-critical software with highest security- and safety-requirements in environments with ever-changing requirements!

An example OCaml program defining nested lists in OCaml. A terminal output also shows the compiler catching a type error where a pattern-match was not exhaustive.

PRODUCTIVITY

First-Class Editor and Tooling

OCaml comes with deep integrations for VS Code, Vim or Emacs to provide type inspection, autocomplete and more. Between Opam, a popular package manager; Utop, a powerful interactive REPL; and odoc, an easy-to-use documentation generator, OCaml programmers have access to a complete, modern developer experience.

PERFORMANCE

Fast Compiler and Applications

OCaml offers great runtime performance without compromising on developer experience: The bytecode compiler generates small, highly portable executables blazingly fast; the native code compiler produces highly-efficient machine code. Despite this focus on performance, the OCaml compiler has always been exceptionally reliable and stable

Users of OCaml

OCaml is used by thousands of developers, companies, research labs, teachers, and more. Learn how it fits your use case.

For Educators

With its mathematical roots, OCaml has always had strong ties to academia. It is taught in universities around the world, and has accrued an ever-growing body of research. Learn more about the academic rigor that defines the culture of OCaml.

Learn more

For Industrial Users

OCaml's powerful compile-time guarantees and high performance empower companies to provide reliable and speedy services and products. Learn more about how OCaml is used in the industry: explore success stories and discover companies that use OCaml.

Learn more

Curated Resources

Get up to speed quickly to enjoy the benefits of the OCaml programming language across your projects.