<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="185941" data-post-id="185941">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Or function:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Foo do
   defp ..., do: IO.puts("Hello there")

  def run do
    ...
    IO.puts("General Kenobi")
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185941" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-185941" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185941"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="185961" data-post-id="185961">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="al2o3cr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/al2o3cr/120/3457_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  al2o3cr
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Not sure if this is a bug or just a spot that needs a better error message, but using <code>...</code> inside a pipe inside a <code>fn</code> inside a pipe fails:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(3)&gt; [1,2,3] |&gt; Enum.map(fn x -&gt; x |&gt; Integer.to_string(10, ...) end)

** (FunctionClauseError) no function clause matching in Magritte.locate/4    
    
    The following arguments were given to Magritte.locate/4:
    
        # 1
        nil
    
        # 2
        0
    
        # 3
        nil
    
        # 4
        []
    
    Attempted function clauses (showing 4 out of 4):
    
        defp locate([{:..., _, args} | rest], pos, nil, acc) when args == [] or not(is_list(args))
        defp locate([{:..., _, args} | _], pos, found, _acc) when args == [] or not(is_list(args))
        defp locate([arg | rest], pos, found, args)
        defp locate([], _, found, args)
    
    (magritte 0.1.1) lib/magritte.ex:91: Magritte.locate/4
    (magritte 0.1.1) lib/magritte.ex:81: Magritte.find_pos/1
    (magritte 0.1.1) lib/magritte.ex:68: Magritte.unpipe/3
    (magritte 0.1.1) lib/magritte.ex:64: Magritte.unpipe/3
    (magritte 0.1.1) lib/magritte.ex:61: Magritte.unpipe/2
    (magritte 0.1.1) expanding macro: Magritte.|&gt;/2
    iex:3: (file)
    (magritte 0.1.1) expanding macro: Magritte.|&gt;/2
    iex:3: (file)
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185961" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-185961" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185961"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="185975" data-post-id="185975">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It wouldn’t work anyway, but I will check that out.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185975" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-185975" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185975"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="186021" data-post-id="186021">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wolf4earth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wolf4earth/120/40066_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wolf4earth
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Is there something which makes the top-level usage absolutely mandatory? In theory it should be possible to traverse the AST, right?</p>
<p>Would you be open for a PR implementing that?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186021" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-186021" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186021"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="186022" data-post-id="186022">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Nothing really, except convenience and less surprising behaviour. Because there would be question in case of something like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo
|&gt; bar(fn -&gt;
  baz(1, ...) # should this work?
end)
</code></pre>
<p>And if the above should work, then how about:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo
|&gt; bar(fn -&gt;
  2 |&gt; baz(1, ...) # which value should be used there?
</code></pre>
<p>If this should outer pipeline, then there is no way to use <code>...</code> in nested pipeline, if nested then the behaviour is inconsistent.</p>
<p>Additionally current implementation disallows duplicated <code>...</code> which would IMHO feel illogical in case of traversing whole tree.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186022" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-186022" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186022"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="186023" data-post-id="186023">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wolf4earth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wolf4earth/120/40066_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wolf4earth
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="hauleth" data-post="16" data-topic="33673">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>Because there would be question in case of something like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo
|&gt; bar(fn -&gt;
  baz(1, ...) # should this work?
end)
</code></pre>
</blockquote>
</aside>
<p>I see nothing wong with this.</p>
<aside class="quote no-group" data-username="hauleth" data-post="16" data-topic="33673">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/48/18942_2.png" class="avatar"> hauleth:</div>
<blockquote>
<p>how about:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo
|&gt; bar(fn -&gt;
  2 |&gt; baz(1, ...) # which value should be
</code></pre>
</blockquote>
</aside>
<p>I also put some thought into this and I’d argue that <code>...</code> should always refer to the inner pipe.</p>
<p>But there is an argument to be made to disallow using <code>...</code> in a nested pipe, similar to how nested captures (<code>&amp;</code>) are disallowed. At the very least this should print a warning in my opinion.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186023" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-186023" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186023"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="186024" data-post-id="186024">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks, fixed on <a href="https://github.com/hauleth/magritte/commit/d5d5591677da85ba342bb4305711cb2dc00e1da8" rel="noopener nofollow ugc">master</a>.</p>
<p>This example could be reduced to the example that is almost a shame that it wasn’t a test:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">x |&gt; foo
</code></pre>
<p><strong>EDIT:</strong> Released <code>0.1.2</code> that fixes this shameful bug.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186024" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-186024" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186024"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="186025" data-post-id="186025">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="wolf4earth" data-post="17" data-topic="33673">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wolf4earth/48/40066_2.png" class="avatar"> wolf4earth:</div>
<blockquote>
<p>I see nothing wong with this.</p>
</blockquote>
</aside>
<p>“Plain” examples often seems right or “nothing wrong”. Like famous C++ example</p>
<pre data-code-wrap="cpp"><code class="lang-cpp">std::vector&lt;int&gt; v = {1,2,3};
int&amp; ref = v[1];
v.push_back(4);
std::cout &lt;&lt; ref;
</code></pre>
<p>That is the problem with such examples.</p>
<aside class="quote no-group" data-username="wolf4earth" data-post="17" data-topic="33673">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wolf4earth/48/40066_2.png" class="avatar"> wolf4earth:</div>
<blockquote>
<p>But there is an argument to be made to disallow using <code>...</code> in a nested pipe, similar to how nested captures ( <code>&amp;</code> ) are disallowed. At the very least this should print a warning in my opinion.</p>
</blockquote>
</aside>
<p>Yeah, but <code>&amp; &amp;1 + &amp;1</code> is allowed, while <code>1 |&gt; Kernel.+(..., ...)</code> is not allowed in Magritte, as it would require additional variable and could cause problems with macros (for example with <code>Logger</code> macros which lazily evaluate arguments).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186025" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-186025" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186025"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="186028" data-post-id="186028">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dorgan" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dorgan/120/22107_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dorgan
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Maybe a dumb question, but if it is an <strong>operator</strong> that works with it’s <em>left</em> and <em>right</em> sides, why should it care about nesting?<br>
I mean, <code>a |&gt; foo(b, ...)</code> is reasonable, but<code>a |&gt; foo(fn x -&gt; bar(x, ...) end)</code> seems completely out of scope for the for the operator’s semantic.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186028" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-186028" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186028"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="186031" data-post-id="186031">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hauleth" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/120/18942_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hauleth
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is how it works right now. <code>a |&gt; foo(b, ...)</code> will work, <code>a |&gt; foo(fn x -&gt; bar(x, ...) end)</code> will not. However that has another cases when it will not work, for example <code>a |&gt; foo(a: ...)</code> will not work as expected.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186031" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-186031" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186031"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/33673/load_more?page=3">Load more posts (4 remaining)</a>
</div></template></turbo-stream>