title: Is it possible to choose where the pipe output is inserted into Elixir function args?
body: <p>Consider a (smelly, non-idiomatic) function like the below:</p>
  
  <pre><code>def update_2d(array, inds, val) do
      [first_coord, second_coord] = inds
  
      new_arr = List.update_at(array, second_coord, fn(y) -&gt;
        List.update_at(Enum.at(array, second_coord),
          first_coord, fn(x) -&gt; val end) end)
  end
  </code></pre>
  
  <p>This function will take in a list of lists, a list of two indices, and a value to insert within the list of lists at the location specified by the indices.</p>
  
  <p>As a first step to making this more Elixir-ey, I start laying pipe:</p>
  
  <pre><code>array 
    |&gt; Enum.at(second_coord) 
    |&gt; List.update_at(first_coord, fn(x) -&gt; val end)
  </code></pre>
  
  <p>That gets me most of the way there, but <strong>how do I pipe that output into the anonymous function of the last <code>List.update_at</code> call?</strong> I can nest it within the original call, but that seems like giving up:</p>
  
  <pre><code>List.update_at(array, second_coord, fn(y) -&gt; 
    array 
    |&gt; Enum.at(second_coord) 
    |&gt; List.update_at(first_coord, fn(x) -&gt; val end) 
  end) 
  </code></pre>