title: Elixir: Capturing the rest of a map using pattern matching
body: <p>I want to simultaneously match on a specific key in a map, <strong>and</strong> capture the rest of that map.  I was hoping something like this would work:</p>
  
  <pre><code>iex(10)&gt; %{"nodeType" =&gt; type | rest} = %{"nodeType" =&gt; "conditional", "foo" =&gt; "bar"}
  
  ** (CompileError) iex:10: cannot invoke remote function IEx.Helpers.|/2 inside match
  </code></pre>
  
  <p>The goal is to write a set of functions which take a map, pattern match on one of the map's fields, and perform some transformations on the rest of the map.</p>
  
  <pre><code>def handle_condition(%{"nodeType" =&gt; "condition" | rest}) do
    # do something with rest
  done
  def handle_expression(%{"nodeType" =&gt; "expression" | rest}) do
    # do something with rest
  done
  </code></pre>
  
  <p>But it looks like I'll need the callee to pass the nodeType separately unless I'm missing something.</p>