concept argument in category elixir

appears as: rguments, argument, The argument, The arguments, n argument, arguments, Arguments
Elixir in Action

This is an excerpt from Manning's book Elixir in Action.

The definition starts with the def construct, followed by the function name, the argument list, and the body enclosed in a do…end block. Because you’re dealing with a dynamic language, there are no type specifications for arguments.

def new(entries \\ []) do
  Enum.reduce(
    entries,
    %TodoList{},
 &add_entry(&2, &1)    #1  
  )
end

#1   Reverses the order of arguments and delegates to add_entry/2

The :id field is an arbitrary term that’s used to distinguish this child from any other child of the same supervisor. The :start field is a triplet in the shape of {module, start_function, list_of_arguments}. When starting the child, the supervisor process will invoke module.start_function, passing it the given list of arguments. This function must start and link the process.

The Little Elixir & OTP Guidebook

This is an excerpt from Manning's book The Little Elixir & OTP Guidebook.

In mailing lists, this format is sometimes known as MFA (Module, Function, and Arguments). Remember this format because you’ll encounter it again in the book.

Let’s go through the last row. Say you want to stop the worker process, and you call Metex.Worker.stop/1. This will in turn invoke GenServer.cast/2, passing in pid and :stop as arguments. The callback that’s triggered is Metex.Worker.handle_cast (:stop, state). If the callback returns a tuple of the form {:stop, :normal, state}, then Metex.Worker.terminate/2 is invoked.

Listing 8.12. Declaring the format of the arguments the program expects (lib/cli.ex)
defp process_options(options) do
  case options do
    {[requests: n], [url], []} ->                     #1
      # To be implemented later.
    _ ->
      do_help
  end
end