What does the slash notation in Elixir mean? -
in elixir docs, keep using odd notation slash, example:
is_boolean/1 io.puts/1 string.length/1 is_function/2 ++/2
i'm guessing, think refers arity. if that's case, why devil isn't mentioned anywhere in docs? it's not if kind of standard convention in (at least, not 1 i've ever seen in 20+ years in it).
from page 2, basic types of getting started documentation:
note: functions in elixir identified name , number of arguments (i.e. arity). therefore,
is_boolean/1
identifies function namedis_boolean
takes 1 argument.is_boolean/2
identifies different (nonexistent) function same name different arity.
it described in erlang/elixir syntax: crash course:
here create module named
hello_module
. in define 3 functions, first 2 made available other modules call viaexport
directive @ top. contains list of functions, each of written in format<function name>/<arity>
. arity stands number of arguments.
i might speculate tends relegated side note in elixir literature because comes straight erlang. although erlang knowledge shouldn't necessary use elixir, such omissions common mistake when people document software derived elixir erlang.
Comments
Post a Comment