-export([consult/1,
dump/2,
first/1,
for/3,
is_prefix/2).
I’m reading documentation and confused with syntax above. What’s the meaning of /1, /2, /3 in the list above?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
/1, /2, /3etc are referred to as the “Arity” of the function, Arity meaning the number of arguments accepted by that function.In Erlang, two functions of with the same name but with different arity are two different functions, and as such are each exported explicitly. To quote the Erlang documentation is says:
For example, if you have two functions:
And at the top of your module, you had only
Then only the do_something with zero arguments would be exported (that is, accessible from other modules in the system).