Let's say that I have a list of structs, with an id as one of its keys:
users = [
%User{id: 1, attempts: 5},
%User{id: 2, attempts: 12},
%User{id: 3, attempts: 2}
]
What would the best way (the most elixir way) to update the number of attempts to 99 of the user with id == 2 to get a new users list:
updated_users = [
%User{id: 1, attempts: 5},
%User{id: 2, attempts: 99},
%User{id: 3, attempts: 2}
]
Thanks for helping!