@tulip scroll Elixir is immutable. Updating data structures in elixir does not mutate them in-place like you might expect in other languages. Try this in an iex shell:
iex(1)> my_map = %{foo: "bar"}
%{foo: "bar"}
iex(2)> Map.put(my_map, :foo, "updated!")
%{foo: "updated!"}
iex(3)> my_map
%{foo: "bar"}
You can see that the variable my_map that has a map in it, retains the old version of the map, even after I called Map.put to update it. This is because Map.put does not mutate the map in-place. It updates the map and returns a new copy with the update. To use it, you have to capture it in a variable:
iex(4)> my_map = %{foo: "bar"}
%{foo: "bar"}
iex(5)> my_map = Map.put(my_map, :foo, "updated!")
%{foo: "updated!"}
iex(6)> my_map
%{foo: "updated!"}
This is the same with the socket data structure in your code and the assign function. It's assigning the new values into the socket, and returning an updated socket.