Ok, so that part is important to you. Ok, in that case my solution is defiinitely unacceptable. Also, my solutino also deviates regarding this:
I my implementation, the code above works:
def factorial_with_map(n) do
mutable! result: 1 do
# Update the product inside a map function
Enum.map(1..n, fn i -> result <<~ result * i end)
# Return the mutable variable
result
end
end
and in my opinion it should work. If we want mutable variables, then they better be real mutable variables instead of a very artificial thing that works in for loops and not in map functions. But that is just my personal opinion, of course.






















