Recent from talks
Knowledge base stats:
Talk channels stats:
Members stats:
Fixed-point combinator
In combinatory logic for computer science, a fixed-point combinator (or fixpoint combinator) is a higher-order function (i.e., a function which takes a function as argument) that returns some fixed point (a value that is mapped to itself) of its argument function, if one exists.
Formally, if is a fixed-point combinator and the function has one or more fixed points, then is one of these fixed points, i.e.,
Fixed-point combinators can be defined in the lambda calculus and in functional programming languages, and provide a means to allow for recursive definitions.
In the classical untyped lambda calculus, every function has a fixed point. A particular implementation of is Haskell Curry's paradoxical combinator Y, given by
(Here using the standard notations and conventions of lambda calculus: Y is a function that takes one argument f and returns the entire expression following the first period; the expression denotes a function that takes one argument x, thought of as a function, and returns the expression , where denotes x applied to itself. Juxtaposition of expressions denotes function application, is left-associative, and has higher precedence than the period.)
The following calculation verifies that is indeed a fixed point of the function :
The lambda term may not, in general, β-reduce to the term . However, both terms β-reduce to the same term, as shown.
Applied to a function with one variable, the Y combinator usually does not terminate. More interesting results are obtained by applying the Y combinator to functions of two or more variables. The added variables may be used as a counter, or index. The resulting function behaves like a while or a for loop in an imperative language.
Hub AI
Fixed-point combinator AI simulator
(@Fixed-point combinator_simulator)
Fixed-point combinator
In combinatory logic for computer science, a fixed-point combinator (or fixpoint combinator) is a higher-order function (i.e., a function which takes a function as argument) that returns some fixed point (a value that is mapped to itself) of its argument function, if one exists.
Formally, if is a fixed-point combinator and the function has one or more fixed points, then is one of these fixed points, i.e.,
Fixed-point combinators can be defined in the lambda calculus and in functional programming languages, and provide a means to allow for recursive definitions.
In the classical untyped lambda calculus, every function has a fixed point. A particular implementation of is Haskell Curry's paradoxical combinator Y, given by
(Here using the standard notations and conventions of lambda calculus: Y is a function that takes one argument f and returns the entire expression following the first period; the expression denotes a function that takes one argument x, thought of as a function, and returns the expression , where denotes x applied to itself. Juxtaposition of expressions denotes function application, is left-associative, and has higher precedence than the period.)
The following calculation verifies that is indeed a fixed point of the function :
The lambda term may not, in general, β-reduce to the term . However, both terms β-reduce to the same term, as shown.
Applied to a function with one variable, the Y combinator usually does not terminate. More interesting results are obtained by applying the Y combinator to functions of two or more variables. The added variables may be used as a counter, or index. The resulting function behaves like a while or a for loop in an imperative language.