title: Elixir map value not updating
body: <p>I wrote a function in Elixir that creates a map then tried changing the value of one of its keys but it doesn't seem to want to update.</p>
  
  <pre><code>defmodule KV do
      def test() do
          map = %{foo: "bar", hello: "world"}
          IO.inspect map.foo
          %{map | foo: "baz"}
          IO.inspect map.foo
      end
  end
  
  KV.test()
  </code></pre>
  
  <p>What I expect to appear after compiling the code is this:</p>
  
  <pre><code>"bar"
  "baz"
  </code></pre>
  
  <p>But what I actually get is this:</p>
  
  <pre><code>"bar"
  "bar"
  </code></pre>
  
  <p>However, when I tried just typing it on the iex shell it does what it's supposed to do:</p>
  
  <pre><code>iex(1)&gt; map = %{foo: "bar", hello: "world"}
  %{foo: "bar", hello: "world"}
  iex(2)&gt; %{map | foo: "baz"}
  %{foo: "baz", hello: "world"}
  </code></pre>
  
  <p>I've tried a number of other methods to update the value but nothing seems to be working.</p>