Naming Functions
We’ve covered how to create anonymous functions, and they are awesome. We can bind them to variables, use them as a function’s arguments, and return them in functions. However, having only anonymous functions can be annoying. If the codebase of a large application used only anonymous functions, it would be very complex. To solve this issue, programming languages have a lot of predefined words that you can use anywhere in the code. These predefined words in Elixir can be special forms, named functions, or macros. We can also create our own named functions.
Named functions are defined inside of modules in Elixir. You can use an atom or aliases to name a module. An alias in Elixir is any word that starts with a capital letter, ...
Get Learn Functional Programming with Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.