Erlang 內建的函式(built-in functions)
基本介紹
- 中文名:內建函式
- 外文名:BIF
built-in functions grouped according to the type of function, with examples illustrating
their use. We will refer to built-in functions as BIFs, a practice almost universal in the
Erlang community. Standard and nonstandard BIFs are listed in the manual page of
the erlang module.
used to manipulate, inspect, and retrieve data as well as interact with the operating
system. An example of a data manipulation function is the conversion of an atom to a
string: atom_to_list/1. Other BIFs, such as length/1, which returns the length of a list,
are implemented in the runtime system for efficiency.
they have made their way to other modules for practicality and efficiency reasons.
Among the modules that contain built-in functions are ets and lists.
VM-dependent and do not necessarily exist in other VM implementations or even in
specific OS ports of the existing VM. Standard built-in functions are auto-imported, so
you can call them without the module prefix. Nonstandard BIFs, however, have to be
prefixed with the erlang module prefix, as in erlang:function. Examples of nonstan-
dard built-in functions include erlang:hash(Term, Range), which returns the hash of
the Term in the specified range; and erlang:display(Term), which prints the term to
standard output and is mainly used for debugging purposes.