Skip to main content

OCaml

OCaml is a functional programming language developed at Inria over the past thirty years. It belongs to the ML family of statically-typed functional languages, which includes Standard ML, ReasonML, and Microsoft's F#. ML was originally developed as the Meta Language for the LCF theorem prover at the University of Edinburgh, and has long been a valuable tool for programmers working with formal logic or developing other programming languages. It was a major influence in the design of the functional languages Haskell and Scala, and more recently it has seen adoption in financial services (for example, Bloomberg and Jane Street) and web development (particularly at Facebook).

One advantage of OCaml is that its compiler is remarkably fast and sophisticated, and it can generate JavaScript output for running programs in a web browser. In fact, since the compiler itself is written in OCaml, it is possible to compile the entire system to JavaScript and run it in the browser.

Here is an editor where you can type in OCaml code and execute it (click the button or type Ctrl-Enter):

If for some reason you want to reset the interpreter before executing the code (so that it will forget previous bindings), press the Shift key plus Ctrl-Enter.