Caml (originally an acronym for Categorical Abstract Machine Language) is a multi-paradigm, general-purpose programming language which is a dialect of the ML programming language family. Caml was developed in France at INRIA and ENS. Caml is statically typed, strictly evaluated, and uses automatic memory management. OCaml, the main descendant of Caml, adds many features to the language, including an object layer. Examples In the following, represents the Caml prompt. Hello World print_endline "Hello, world!";; Factorial function (recursion and purely functional programming) Many mathematical functions, such as factorial, are most naturally represented in a purely functional form. The following recursive, purely functional Caml function implements factorial: let rec fact n = if n=0 then 1 else n * fact(n - 1);; The function can be written equivalently using pattern matching: let rec fact = function | 0 -> 1 | n -> n * fact(n - 1);; This latter form is the mathematical definition of factorial as a recurrence relation. Note that the compiler inferred the type of this function to be , meaning that this function maps ints onto ints. For example, 12! is: # fact 12;; - : int = 479001600 Numerical derivative (higher-order functions) Since Caml is a functional programming language, it is easy to create and pass around functions in Caml programs. This capability has an enormous number of applications. Calculating the numerical derivative of a function is one such application. The following Caml function computes the numerical derivative of a given function at a given point : let d delta f x = (f (x +. delta) -. f (x -. delta)) /. (2. *. delta);; This function requires a small value . A good choice for delta is the cube root of the machine epsilon. The type of the function indicates that it maps a onto another function with the type . This allows us to partially apply arguments. This functional style is known as currying. In this case, it is useful to partially apply the first argument to , to obtain a more specialised function: # let d = d (sqrt epsilon_float);; val d : (float -> float) -> float -> float = <fun> Note that the inferred type indicates that the replacement is expecting a function with the type as its first argument. We can compute a numerical approximation to the derivative of at with: # d (fun x -> x *. x