What does the slash notation in Elixir mean?

From page 2, Basic types of the Getting started documentation:

Note: Functions in Elixir are identified by name and by number of arguments (i.e. arity). Therefore, is_boolean/1 identifies a function named is_boolean that takes 1 argument. is_boolean/2 identifies a different (nonexistent) function with the same name but different arity.

It is also described in Erlang/Elixir Syntax: A Crash Course:

Here we create a module named hello_module. In it we define three functions, the first two are made available for other modules to call via the export directive at the top. It contains a list of functions, each of which is written in the format <function name>/<arity>. Arity stands for the number of arguments.

I might speculate that this tends to be relegated to a side note in Elixir literature because it comes straight from Erlang. Although Erlang knowledge shouldn’t be necessary to use Elixir, such omissions are a common mistake when people document software that is derived as Elixir is from Erlang.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)