Clause
← All documentation

Function values

Plan 11 steps 32–35 (2026-10-07): fun F/A, fun M:F/A, anonymous funs with captured variables (closures), named funs (fun Name(...) -> ... end), calls of function values (F(Args)) and dynamic calls (M:F(Args), apply/2,3). Facts come from the pinned maint-29 sources (erts/emulator/beam/utils.c erts_cmp, erl_printf_term.c, erl_lint) and probes on OTP 29.1.1.

Values

SourceValueCalls enter
fun f/1Local fun of this module; every fun f/1 of a module is the same valuef/1 of this module, exported or not
fun m:f/1External fun naming m:f/1, also for the current modulem:f/1 when a module of the program exports it
fun(X) -> ... endLocal fun capturing the variables it reads from its creator; each evaluation builds a new valueThe fun's own generated function
fun Name(X) -> ... endThe same, with Name bound to the fun inside its clausesThe fun's own generated function
fun M:F/A with variablesExternal fun built when evaluated; equal to the literal fun m:f/1 it namesm:f/1 when a module of the program exports it

Dynamic calls

Closures

Representation

Comparison and printing

Differences

Recorded in differences: