What is the difference between the `fun` and `function` keywords?

Viewed 22694

Sometimes I see code like

let (alt : recognizer -> recognizer -> recognizer) =
  fun a b p -> union  (a p) (b p)

Or like:

let hd = function
    Cons(x,xf) -> x
  | Nil -> raise Empty

What is the difference between fun and function?

4 Answers
fun x1 ... xn -> e

is an abbreviation for

function x1 -> ... -> function xn -> e
Related