title: Referencing piped value in Elixir
body: <p>I want to count the number of word-occurrences in a string. The implementation is questionable, but lets use it to demonstrate my problem:</p>
  
  <pre><code>  def count(sentence) do
      words = String.split(sentence)
      occurrences = Enum.map(words, fn w -&gt; {w, Enum.count(words, &amp;(&amp;1 == w))} end)
      Map.new(occurrences)
    end
  </code></pre>
  
  <p>I would like to achieve the same result as above, but using pipes instead of intermediate result variables:</p>
  
  <pre><code>def count(sentence) do
      sentence
      |&gt; String.split
      |&gt; Enum.map(fn w -&gt; {w, Enum.count(???)} end)
      |&gt; Map.new
    end
  </code></pre>
  
  <p>Is it possible to reference the piped in value in the Enum.count function? Or do i have to use an intermediate variable?</p>