What does it mean “Observation: Functions are first-class values in this language”?
functions can be used as any other value (like an
int for example),
you can make a let binding, put it inside a list or any other structure, pass it as parameter to another function.
let f = (fun v -> v + 1) let f_list = [f; f; f] let f_some = Some f List.map f [1; 2; 3]
A longer explanation on Wikipedia:
You can treat a function like any other value in the language. Historically in many other languages this was either not possible, or difficult to do. OCaml makes it trivial to use functions as if they were any other value… for example, you can bind a function to a variable and pass that variable to another function. You can create lists of functions, etc…