So I finally hopped on Slack (it really is like a worse gitter, not even code syntax highlighting, but that is for another post), and someone there said, and I quote:
Afaik people avoid Enum anyway
I rarely ever touch Enum
Pretty sure @david.antaramian also said at one point he rolls his own rather than Enum (although I might be wrong)
I think the general consensus is Enum until you know how to write Elixir comfortably, then roll your own as needed
because iteration is rarely ever generic
And that goes against everything I’ve been doing in Erlang for ten years.
Do people really not use the functional patterns in Elixir? Heck, I’ve found it beyond hard pressed to get anything self-written to perform faster than Enum.map (the example we were using) and even than it was less than 1% speed difference with a substantially larger amount of code.
Is this really true for people? I use Enum extensively (occasionally even drop down to the base erlang function just because familiarity and the arguments are in the right order (*cough*callback*funs*first*cough*), but even that is waning as Enum can do about everything). So someone saying that Enum is not generic enough for iteration
is mind boggling to me…
If Enum (and other similar functional things like for-comprehensions) are not really used (outside my own work apparently?), do people really ‘roll their own function loops’ that often? Sure they are easy but they harder to follow than a simple Enum |>
chain, harder to read, breaks the flow of data up significantly more, and slower in every benchmark we passed between compared to Enum on Erlang OTP 19 (the hand-rolled ones were from between 5% to 9% slower than the single-line Enum’s on my machine with repeated tests, Ubuntu 16.04 latest everything).
So yeah, do people really not use Enum/for-comprehensions and instead do it manually? I’ve been doing erlang for almost ten years and other functional languages for a decade before that and I would never consider doing such a thing, even if for a 10% speed bonus unless absolutely necessary, it is a code-reading-nightmare to me…