AssociativityTutorial (draft)Higher-order: two well-known examplesHigher-order functionsDocumentation and user's manualTable of contentsOCaml programs

Higher-order functions

   
  This is an approximate definition of the notion of a higher-order function:

A higher-order function is a function whose argument is a function and/or whose result of application is a function.

To get a correct definition, replace all occurrences of a function but the first one with a tuple at least one component of which is a function:

A higher-order function is a function whose argument is a tuple at least one component of which is a function and/or whose result of application is a tuple at least one component of which is a function.

   
  This is another correct definition:

A higher-order function is a function whose type contains at last two arrows.

For instance here are the types of functional values previously written:

val unary_of_int_add : int -> (int -> int)

val unary_of_real_mult : float -> (float -> float)

val unary_of_string_concat : string -> (string -> string)

Here are the types of the function  make  provided by the Objective Caml  String  module ( (String.make (n)) (c)  returns a fresh string of length  n , filled with the character  c ) and of the function  append  (catenates two lists and has the same meaning as the infix operator  @ ) provided by its  List  module:

val make : int -> (char -> string)

val append : 'a list -> ('a list -> 'a list)


Latest update : October 5, 2006
This document was translated from LaTeX by Hyperlatex 2.5, which is not the latest version of Hyperlatex.

AssociativityTutorial (draft)Higher-order: two well-known examplesHigher-order functionsDocumentation and user's manualTable of contentsOCaml programs