I love elixir and am very comfortable with functional programming and generally prefer it. But being told you have to write a state machine instead of just += a var is an excellent experience in believing elixir is harder than python.
But comparing:
i = 0
for x in [1, 2, 3, 4]:
i += x
vs i = Enum.reduce([1, 2, 3, 4], fn x, i -> i + x end)
There is nothing inherently "harder" about the functional version, it's just different (and of course comes with its own benefits). Enum.sum([1, 2, 3, 4])
Exist ;) sum([1, 2, 3, 4])
so obviously not my point :P;)
When you have an imperative loop the state of any of the variables youve declared is up in the air. It gets even worse if you've shadowed variable names.