“When an operation cannot be expressed by any of the functions in the Enum module, developers will most likely resort to reduce/3.”
From the docs for Enum.reduce/3
In many Elixir applications, I find
Enum.reduce
is used frequently.Enum.reduce
can do anything, but that doesn’t mean it should. In many cases, other Enum functions are more readable, practically as fast, and easier to refactor.I would also like to discuss situations that are a good fit for
Enum.reduce
and also introduce you to a customcredo
check I’ve created, which can help you identify places whereEnum.reduce
could be replaced with a simpler option.
continue reading on www.erlang-solutions.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.