Michael Terry
Michael Terry

Reputation: 992

Where in Elixir's documentation is the method to call Erlang code described?

You can call functions in Erlang modules by prepending a colon:

:erlang.time()

...but where is this notation described in the Elixir reference documentation?

I ask because I'd prefer to use the straight docs to master Elixir, but I apparently need some initial bootstrapping information to understand how critical bits are organized.

Upvotes: 2

Views: 214

Answers (2)

PatNowak
PatNowak

Reputation: 5812

This information is well known, but it's not mentioned in the reference documentation, where you have purely Elixir-specific stuff.

Just check the official introduction to Elixir. The most valid part of it for you is:

Note. Since Erlang modules are represented by atoms, you may invoke Erlang functions in Elixir as follows:

:lists.sort [3, 2, 1]

All of the Erlang built-ins reside in the :erlang module.

Upvotes: 2

Onorio Catenacci
Onorio Catenacci

Reputation: 15293

I don't think it's stated directly. The name of each Erlang module is an atom. Prefacing a string with a colon indicates the string is an atom. :Module. function simply resolves to a specific function in a module in Erlang.

Upvotes: 0

Related Questions