Concise way of “updating” element in nested collections
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
0
$begingroup$
Imagine simple game: type Combatant = { hp : int attack : int } type CombatantGroup = Combatant list type CombatantGroups = CombatantGroup list type Battle = { combatantGroups : CombatantGroups } there is some battle, in which some amount groups participate. In each group there is several combatants. Now I want to implement a function for one combatant to attack another. Due to immutability, I have to replace whole attacked target, and whole group and whole battle. If the battle was just between two participants, I could write code like this: if target = battle.combatant1 then { battle with combatant1 = { battle