title: What is the "pin" operator for, and are Elixir variables mutable?
body: <p>Currently trying to understand the "^" operator in Elixir.
  From the website:</p>
  
  <blockquote>
    <p>The pin operator ^ can be used when there is no interest in rebinding
    a variable but rather in matching against its value prior to the
    match:</p>
  </blockquote>
  
  <p>Source - <a href="http://elixir-lang.org/getting_started/4.html" rel="noreferrer">http://elixir-lang.org/getting_started/4.html</a></p>
  
  <p>With this in mind, you can attach a new value to a symbol like so:</p>
  
  <pre><code>iex&gt; x = 1  # Outputs "1"
  iex&gt; x = 2  # Outputs "2"
  </code></pre>
  
  <p>I can also do:</p>
  
  <pre><code>iex&gt; x = x + 1  # Outputs "3"!
  </code></pre>
  
  <p><em>So my first question is; Are Elixir variables mutable?</em>
  It sure looks like if that's the case... Shouldn't that be possible in a functional programming language?</p>
  
  <p>So now we come to the "^" operator...</p>
  
  <pre><code>iex&gt; x = 1  # Outputs "1"
  iex&gt; x = 2  # Outputs "2"
  iex&gt; x = 1  # Outputs "1"
  iex&gt; ^x = 2 # "MatchError"
  iex&gt; ^x = 1  # Outputs "1"
  </code></pre>
  
  <p>I think the effect of "^" is to lock "x" to the last value binded to it. Is that all there is to it?
  Why not just ensure that all 'matches'/assignments are immutable like Erlang itself?</p>
  
  <p>I was just getting used to that...</p>