Accessing list element with put_in for lists of structs

I think finding a player by id is quite frequent. For example, when a player joins the game, you also want to make sure you won’t add him/her twice if already in the room.

So I often end up with having the connected_players list as a map, whose keys are ids. Would that be easier for you?

%Game{connected_players: %{"foo" => %Player{id: "foo", ...}}}