Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Erlang Programming/Modules

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Erlang modules Each Erlang Programming source file utility.erl is required to be a separate module. Modules are created with the module statement. -module(utility). % 1 -export([rotate/1]). % 2 % 3 rotate([H|T]) -> % 4 T ++ [H]. % 5 compile with c(utility). run with utility:rotate([1,2,3]). and get [2,3,1]. "utility" is the module created by the file utility.erl utility functions like rotate can be imported elsewhere with: -import(utility). so now we do not need to use the "utility:" prefix. Importing modules is not generally recommended. This is very similar to python and Java imports.