Re: [elixir-core:11942] Proposal: Map.put_if/4

2024-12-06 Thread Jean Klingler
For reference, there has been a previous discussion about then_if: https://groups.google.com/g/elixir-lang-core/c/uM_M-DWh42A/m/6pNKZcLyAQAJ?pli=1 Le ven. 6 déc. 2024 à 23:59, José Valim a écrit : > Hi Juan! > > My initial gut feeling is that this approach does not scale. What if you > want to

Re: [elixir-core:11942] Proposal: Map.put_if/4

2024-12-06 Thread Christopher Keele
> We could get cuter with the syntax by overloading guards: update map when condition do Map.put(map, :key, value) end It was pointed out to me that this would either have to work only with guard-compatible conditions or be wildly inconsistent with the rest of the language, so I think this synt