So we are stick with this half Y-combinator solution? What a shame
iex(9)> f = fn l -> g = fn [], _ -> []; [h|t], f -> [h+1|f.(t,f)] end; g.(l,g) end
#Function<44.79398840/1 in :erl_eval.expr/5>
iex(10)> f.([3,41,5])
[4, 42, 6]
It’s like going ten years backwards when we have to do this in Erlang.
Yes, you solved this trivial example but what if I would like to make function which returns recursive anonymous function with nontrivial closure. For example returning ad hoc enumerate protocol implementation.