Open main menu

Wikibooks β

Erlang Programming/Function Objects

< Erlang Programming

Function ObjectsEdit

Function objects can be named or unnamed, or stored in a variable. Function objects can be like lambda expressions. Lambda expression in Erlang are created with the keyword "fun". Lambda expressions are unnamed functions that can be stored in variables. Please consider the following:

Sample Erlang command line code:

Mod = fun(X,Y) -> X rem Y end.

Generic behaviors often use function objects to become specialized. A generic server can be dynamically given a function object to allow it to become a particular type of server or service provider.