> On 6 Dec 2024, at 23:27, Christopher Keele <christheke...@gmail.com> wrote:
> 
> map = if condition, else: map do

This reminds me a lot of with + when:

    iex> map = %{a: 1} ; condition = true ; with _ when condition <- map do ; 
Map.put(map, :b, 2) ; end
    %{a: 1, b: 2}
    iex> map = %{a: 1} ; condition = false ; with _ when condition <- map do ; 
Map.put(map, :b, 2) ; end
    %{a: 1}

Of course above is not super ergonomic to type (and limits condition to guard 
expressions) but maybe it is an angle worth exploring.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/elixir-lang-core/76E6944C-EAEE-498B-85A2-07027F78F518%40wojtekmach.pl.

Reply via email to