Back to Intrepreter,       About,       Specifications

Examples :

Simple integers, atoms, strings can be typed as expressions. Note that expressions must be terminated by dot(.)

99999 * 88888 * 77777 * 66666 * 55555.
Arithmetic expressions can be entered directly for evaluations. Hence interpreter can be used as powerful programmable online calculator.

Variables can be bound to values. Value can be of any type integer, float, string, binary, bitstring, tuple, list, etc.

Value bound to variables can be read

Double=fun(X) -> 2*X end.
Anonymous functions can be bound to variables.

Anonymous functions can be executed with arguments.

Triple=fun(X) -> 3*X end, X2=Triple(3), Triple(X2).
We can give multiple sub-expressions in same expression separated by comma(,). In such cases intermediate MFAs are shown in trace output. Only value of final expression is printed in output area (similar to behavior erl shell).

[2*X || X<-[1, 2, 3, 4, 5]].
List comprehension can be used for list processing.

lists:map(fun(X) -> 2*X end, [1, 2, 3, 4, 5]).
Functions of lists module can be called for list processing. Refer to specifications page for understanding which external modules and functions can be called.

Factorial=fun(1, Result, Self) -> Result; (N, Acc, Self) -> Self(N-1, Acc*N, Self) end, Factorial(5, 1, Factorial).
Anonymous functions can be recursive by having function itself as parameter to function. Calls to recursvie functions are also traced properly.

Year=element(1, date()).
Built-in functions can be called.