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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="DaAnalyst" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  DaAnalyst
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Gave it another thought and I generally like this proposal.</p>
<ul>
<li>First, as mentioned earlier, I see a good use for it in situations other than just comprehensions, e.g. in <code>cond</code>’s:</li>
</ul>
<pre data-code-wrap="elixir"><code class="lang-elixir">  cond do
    !first_thing_checks? -&gt;
      :bad

    ( @@foo = expensive_call( args)) &amp;&amp; !@foo.this_ok? -&gt;
      :bad

    @@foo &amp;&amp; @@foo.surely_not_this? &amp;&amp; something_bad -&gt;
      :bad

    true -&gt;
      :good
  end
</code></pre>
<ul>
<li>Second, as another user here noted, I too find <code>@@</code> to be an obscene token, but it’s ok it’s obscene because it’s very noticeable meaning any grouping of/littering with those (i.e. an abuse) will be easy to spot. Also, the reason why I prefer it over using plain variable names e.g. <code>mut foo</code>.</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310211" data-batch-url="/posts/batch_likers">
                        1
                      </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/local-accumulators-for-cleaner-comprehensions/60130/137">Post #136</a>
	                </div>
	            </div>
              <div id="likers-container-310211" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310211"
                     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 #136"></div>
  </section>
</div>
    <div class="postbit" id="310216" data-post-id="310216">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/41119_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>After I overslept with the problem, I decided to comment on it again.</p>
<p>Here is the pure comprehension solution, verbose</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for {map, map_idx} &lt;- Enum.with_index(input, 1), reduce: {1, []} do
  {idx, result} -&gt;
    idx = if map["reset_lesson_position"], do: 1, else: idx

    {idx, lessons} =
      for lesson &lt;- map["lessons"], reduce: {idx, []} do
        {idx, acc} -&gt; {idx + 1, [Map.put(lesson, "position", idx) | acc]}
      end
      
    map = map |&gt; Map.put("position", map_idx) |&gt; Map.put("lessons", Enum.reverse(lessons))
    {idx, result ++ [map]} # to avoid `Enum.reverse/1`
end
</code></pre>
<p>This is not easily generalizable (unlike <code>iteraptor</code>’s solution I mentioned above,) but it solves the exact problem stated. It’s readable by anyone familiar with <em>Elixir</em> and it is arguably more succinct compared to <code>map_reduce/3</code>, although it uses the same approach.</p>
<p>Would I personally write this in the production code? Nope. I’d do it with (<img src="https://forum.elixirforum.com/images/emoji/apple/drum.png?v=15" title=":drum:" class="emoji" alt=":drum:" loading="lazy" width="20" height="20"> <img src="https://forum.elixirforum.com/images/emoji/apple/drum.png?v=15" title=":drum:" class="emoji" alt=":drum:" loading="lazy" width="20" height="20"> <img src="https://forum.elixirforum.com/images/emoji/apple/drum.png?v=15" title=":drum:" class="emoji" alt=":drum:" loading="lazy" width="20" height="20">) <code>Enum.chunk_by/2</code>.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(1)&gt; Enum.chunk_by(input, &amp; &amp;1["reset_lesson_position"])
[
  [
    %{
      "lessons" =&gt; [%{"name" =&gt; "Welcome"}, %{"name" =&gt; "Installation"}],
      "reset_lesson_position" =&gt; false,
      "title" =&gt; "Getting started"
    },
    %{
      "lessons" =&gt; [
        %{"name" =&gt; "Addition / Subtraction"},
        %{"name" =&gt; "Multiplication / Division"}
      ],
      "reset_lesson_position" =&gt; false,
      "title" =&gt; "Basic operator"
    }
  ],
  [
    %{
      "lessons" =&gt; [%{"name" =&gt; "Mutability"}, %{"name" =&gt; "Immutability"}],
      "reset_lesson_position" =&gt; true,
      "title" =&gt; "Advanced topics"
    }
  ]
</code></pre>
<p>Then it’s a matter of <code>Enum.with_index/2</code>.</p>
<hr>
<p>I am positive (this is a not humble opinion <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20">) that every case should be attempted in the way suggested by its shape. Semi-mutability which is not a mutability but rather a syntactic sugar, is not a silver bullet. This particular example, as shown above, might be solved more elegantly. Another example might ring a bell, but this one does not.</p>
<p>As an author of some libraries, I sometimes have a feeling that hey, I should add something cute to it, and I do, and I always regret it. I could not respect more your vision of what is good for the language/ecosystem, and what’s not, <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>, but I think you are falling into a trap here. Local semi-mutability which is not a mutability but rather a syntactic sugar cannot even be <em>named</em> properly without confusing readers.</p>
<p>It’s not something that would help newcomers (IMHO) because of “ok, there is some mutability, they say, let me try with what I am familiar to” in many cases when the pure functional solution <em>fits better</em>.</p>
<p>It’s not something that would impress gray-bearded alchemists, because we know how to do it better without breaking the paradigm.</p>
<p>The question “who is the main audience” is widely open. It’s not an ad-hoc, the proposed solution with double-at already is a backward-incompatible change.</p>
<p>That all said, I am fine with whatever José thinks about it, because in my experience he is usually right and I am not (that’s the 102% fact.) But at the moment my personal opinion is we need more examples to convince the audience this is a good addition that brings more value than it blurs the boundaries of the paradigm we all are accustomed to.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310216" data-batch-url="/posts/batch_likers">
                        11
                      </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/local-accumulators-for-cleaner-comprehensions/60130/138">Post #137</a>
	                </div>
	            </div>
              <div id="likers-container-310216" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310216"
                     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 #137"></div>
  </section>
</div>
    <div class="postbit" id="310217" data-post-id="310217">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="1" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In fact, the code above would fail to compile. Once we enter an anonymous function, any local accumulator becomes read-only. Passing a local accumulator to another function will only pass its current value.</p>
</blockquote>
</aside>
<p>Got it.</p>
<p>Question, what would happen if someone wrote</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def somefn do
   ... no mention or assignment of @@var
  if sometest, do: @@var = true
  ...
  if @@var do
  ...
 end
end
</code></pre>
<p>I assume a compilation errorr, where would the compiler fail?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310217" 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/local-accumulators-for-cleaner-comprehensions/60130/139">Post #138</a>
	                </div>
	            </div>
              <div id="likers-container-310217" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310217"
                     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 #138"></div>
  </section>
</div>
    <div class="postbit" id="310219" data-post-id="310219">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="127" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>I grepped Livebook and I found this:</p>
</blockquote>
</aside>
<p>I just tried to refactor this a bit and came up with this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Result do
  use TypedStruct

  typedstruct do
    field(:branching_ids, MapSet.t())
    field(:warnings, list(String.t()))
  end

  def new(), do: %__MODULE__{branching_ids: MapSet.new(), warnings: []}

  def add_ignored_parernt_warning(self, name),
    do: %{
      self
      | warnings: [
          ~s{ignoring the parent section of "#{name}", because it comes later in the notebook}
          | self.warnings
        ]
    }

  def add_branching_warning(self, name),
    do: %{
      self
      | warnings: [
          ~s{ignoring the parent section of "#{name}", because it is itself a branching section}
          | self.warnings
        ]
    }

  def track_branches(self, id),
    do: %{self | branching_ids: MapSet.put(self.branching_ids, id)}

  def branching_member?(self, id), do: MapSet.member?(self.branching_ids, id)
end

defmodule Example do
  def do_clean(notebook) do
    {sections, result} =
      notebook.sections
      |&gt; Enum.with_index()
      |&gt; Enum.map_reduce(Result.new(), fn {section, section_idx}, result -&gt;
        case section.parent_id do
          nil -&gt;
            {section, result}

          {:idx, parent_idx} -&gt;
            parent = Enum.at(notebook.sections, parent_idx)

            cond do
              section_idx &lt;= parent_idx -&gt;
                {%{section | parent_id: nil},
                 Result.add_ignored_parernt_warning(
                   result,
                   section.name
                 )}

              !is_nil(parent) &amp;&amp; Result.branching_member?(result, parent.id) -&gt;
                {%{section | parent_id: nil},
                 Result.add_branching_warning(
                   result,
                   section.name
                 )}

              true -&gt;
                {%{section | parent_id: parent.id}, Result.track_branches(result, section.id)}
            end
        end
      end)

    {sections, result.warnings}
  end
end
</code></pre>
<p>I’m not sure it’s better or worse. But it’s different. I was time constrained and I have some ideas on how to improve the refactoring some more, but it can already give an example of possible options to change the code.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310219" 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/local-accumulators-for-cleaner-comprehensions/60130/140">Post #139</a>
	                </div>
	            </div>
              <div id="likers-container-310219" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310219"
                     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 #139"></div>
  </section>
</div>
    <div class="postbit" id="310220" data-post-id="310220">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>BTW I saw that F# also has <a href="https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/values/#mutable-variables" rel="noopener nofollow ugc">mutable variables</a>, wondering if we can survey the F# users(and the creators) to see how do they use it and what do they like or don’t about it</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310220" data-batch-url="/posts/batch_likers">
                        6
                      </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/local-accumulators-for-cleaner-comprehensions/60130/141">Post #140</a>
	                </div>
	            </div>
              <div id="likers-container-310220" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310220"
                     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 #140"></div>
  </section>
</div>
    <div class="postbit" id="310221" data-post-id="310221">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Hermanverschooten" data-post="139" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hermanverschooten/48/6447_2.png" class="avatar"> Hermanverschooten:</div>
<blockquote>
<p>Question, what would happen if someone wrote</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def somefn do
   ... no mention or assignment of @@var
  if sometest, do: @@var = true
  ...
  if @@var do
  ...
 end
end
</code></pre>
<p>I assume a compilation errorr, where would the compiler fail?</p>
</blockquote>
</aside>
<p>Also consider</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def somefn do
  # ... no mention or assignment of @@var
  for element &lt;- [1, 2, 3] do
    @@var + 1
    element
  end
end
</code></pre>
<p>This is why I think the <code>@@</code> syntax would require a different initialization declaration syntax (ex <code>@@var 0</code>) from update (ex <code>@@var = @@var + 1</code>).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310221" data-batch-url="/posts/batch_likers">
                        1
                      </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/local-accumulators-for-cleaner-comprehensions/60130/142">Post #141</a>
	                </div>
	            </div>
              <div id="likers-container-310221" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310221"
                     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 #141"></div>
  </section>
</div>
    <div class="postbit" id="310223" data-post-id="310223">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bartblast" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/120/17647_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bartblast
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Hologram</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I like the idea of the accum block; in fact, I had thought about it myself, as did a few others in this thread. It just feels like a natural fit for Elixir. To me, it serves as a signal for the scope, somewhat discouraging its usage (which is good) due to the longer syntax and indicating that it’s something special.</p>
<p>I also believe that a visual marker is necessary to differentiate it from “normal” variables. Perhaps something like <code>@@my_var</code>, <code>!my_var</code>, <code>&amp;my_var</code>, <code>&amp;&amp;my_var</code>, etc. The last ones might give off a “mutable” vibe for those familiar with C/C++/Rust.</p>
<p>I don’t think there needs to be a separate operator for this, considering how it would work with pattern matching.</p>
<p>So, for me, something like this looks good:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">accum &amp;my_var: 123 do
  ...
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="310223" 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/local-accumulators-for-cleaner-comprehensions/60130/143">Post #142</a>
	                </div>
	            </div>
              <div id="likers-container-310223" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310223"
                     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 #142"></div>
  </section>
</div>
    <div class="postbit" id="310225" data-post-id="310225">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/41119_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bartblast" data-post="143" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/48/17647_2.png" class="avatar"> bartblast:</div>
<blockquote>
<p><code>&amp;my_var</code></p>
</blockquote>
</aside>
<p>This is taken by anonymous function captures.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">(&amp;IO.inspect/2).(:foo, label: "bar")
bar: :foo
#⇒ :foo
</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="310225" data-batch-url="/posts/batch_likers">
                        1
                      </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/local-accumulators-for-cleaner-comprehensions/60130/144">Post #143</a>
	                </div>
	            </div>
              <div id="likers-container-310225" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310225"
                     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 #143"></div>
  </section>
</div>
    <div class="postbit" id="310228" data-post-id="310228">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bartblast" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/120/17647_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bartblast
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Hologram</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yeah, but the function capture requires arity, so I think it would be possible to distinguish it by AST:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; quote do &amp;my_fun/2 end
{:&amp;, [],
 [{:/, [context: Elixir, imports: [{2, Kernel}]], [{:my_fun, [], Elixir}, 2]}]}
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; quote do &amp;my_var end
{:&amp;, [], [{:my_var, [], Elixir}]}
</code></pre>
<p>The problem is that both “&amp;” and “&amp;&amp;” are already Elixir operators, so is it even possible?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310228" data-batch-url="/posts/batch_likers">
                        1
                      </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/local-accumulators-for-cleaner-comprehensions/60130/145">Post #144</a>
	                </div>
	            </div>
              <div id="likers-container-310228" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310228"
                     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 #144"></div>
  </section>
</div>
    <div class="postbit" id="310256" data-post-id="310256">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I like the proposal <img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310256" 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/local-accumulators-for-cleaner-comprehensions/60130/146">Post #145</a>
	                </div>
	            </div>
              <div id="likers-container-310256" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310256"
                     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 #145"></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/60130/load_more?page=15">Load more posts (105 remaining)</a>
</div></template></turbo-stream>