Home [En]

OCaml is a general purpose industrial-strength programming language with an emphasis on expressiveness and safety. Developed for more than 20 years at Inria it benefits from one of the most advanced type systems and supports functional, imperative and object-oriented styles of programming. Read more...

OCaml 2013

The OCaml Users and Developers Workshop

Boston MA, United States, Sep 24

Submit a Talk

Commercial Users of Functional Programming 2013

Boston MA, United States, Sep 22-24

Submit a Talk

A taste of OCaml

(* Binary tree with leaves carrying an integer. *)
type tree = Leaf of int | Node of tree * tree

let rec exists_leaf test tree =
  match tree with
  | Leaf v -> test v
  | Node (left, right) ->
      exists_leaf test left
      || exists_leaf test right

let has_even_leaf tree =
  exists_leaf (fun n -> n mod 2 = 0) tree

OCaml is a lot more powerful than this simple example shows. Pursue with a stronger taste!