You’re missing the first argument to Map.put/3 in the reduce example. It should read:
Enum.reduce(users, %{}, fn user, acc -> Map.put(acc, user.id, user) end)
I’ll agree with others to say that reduce makes more sense to me here because you are “reducing” a list to a single value (a map), and doing it with one function instead of two.






















