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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="stefanchrobot" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/stefanchrobot/120/7657_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  stefanchrobot
                  </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="28" data-topic="44773" data-full="true">
<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>Oh, this discussion gave me another idea for a name, <code>init</code>:</p>
</blockquote>
</aside>
<blockquote>
<p>Instead of starting with a generator, our comprehension starts with a <code>let variable = initial</code> expression.</p>
</blockquote>
<p>I think <code>init</code> works better as a “special type of generator”/“generator wrapper”:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for sum &lt;- init(0), x &lt;- [1, 2, 3] do
  {x * 2, sum + x}
end
</code></pre>
<p>This looks unsurprising to my eye.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237011" 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/introducing-for-let-and-for-reduce/44773/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-237011" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237011"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="237012" data-post-id="237012">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="lud" data-post="29" data-topic="44773">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/48/14382_2.png" class="avatar"> lud:</div>
<blockquote>
<p>It’s nice but it still does not convey the fact that the value is updated from the return tuple and the new value is reinjected on later iterations very well.</p>
</blockquote>
</aside>
<p>I think the reinjection is somewhat implied because of <code>for</code>. But you are right, there is nothing conveying the fact it is updated from the return tuple.</p>
<p>Honestly, the only option so far that conveys this fact is <code>map_reduce</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for map_reduce(sum = 0), x &lt;- [1, 2, 3] do
  {x * 2, sum + x}
end
</code></pre>
<p>But if we were to call it <code>map_reduce</code>, I would change the tutorial to first introduce <code>reduce</code>, and then introduce <code>map_reduce</code> as a way of getting <code>for</code> to return its value and <code>reduce</code> at the same time.</p>
<p>I still have reservations about calling <code>map_reduce</code>, I am worried it is not immediately clear to those who are initially looking at it, but given we simply cannot agree on a new word, it may be that the best option is to use the vocabulary we already have.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237012" data-batch-url="/posts/batch_likers">
                        4
                      </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/introducing-for-let-and-for-reduce/44773/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-237012" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237012"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="237016" data-post-id="237016">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Given a for comprehension has the following pipeline</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">generation -&gt; filter -&gt; reduction
</code></pre>
<p>There are currently two variations</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">generation -&gt; filter -&gt; map
generation -&gt; filter -&gt; reduce
</code></pre>
<p>and this discussion seems to be largely about adding</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">generation -&gt; filter -&gt; map_reduce
</code></pre>
<p>IMHO the existing form describes this pipeline very well:</p>
<h4><a name="p-237016-map-1" class="anchor" href="#p-237016-map-1" aria-label="Heading link" rel="nofollow"></a>map</h4>
<pre data-code-wrap="elixir"><code class="lang-elixir">[2, 4, 6, 8, 10] == for i &lt; [1, 2, 3, 4, 5], is_odd(i), do: i * 2
</code></pre>
<h4><a name="p-237016-reduce-2" class="anchor" href="#p-237016-reduce-2" aria-label="Heading link" rel="nofollow"></a>reduce</h4>
<pre data-code-wrap="elixir"><code class="lang-elixir">9 == for i &lt;- [1, 2, 3, 4, 5], is_odd(i), reduce: 0, do
  acc -&gt; i + acc
end
</code></pre>
<p>Adding support for <code>map_reduce</code> could follow this existing form with:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{[2, 6, 10], 9} == for i &lt;- [1, 2, 3, 4, 5], is_odd(i), map_reduce: 0, do
  acc -&gt; {i*2, i + acc}
end
</code></pre>
<p>The lesson example would then read as</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{sections, _acc} =
  for section &lt;- sections, map_reduce: {1, 1} do
    {section_counter, lesson_counter} -&gt;
        lesson_counter = if section["reset_lesson_position"], do: 1, else: lesson_counter

        {lessons, lesson_counter} =
            for lesson &lt;- section["lessons"], map_reduce: lesson_counter do
              lesson_counter -&gt; 
                {Map.put(lesson, "position", lesson_counter), lesson_counter + 1}    
            end

        section =
            section
            |&gt; Map.put("lessons", lessons)
            |&gt; Map.put("position", section_counter)

        {section, {section_counter + 1, lesson_counter}}
  end)
</code></pre>
<p>Compared to the proposed form there’s little in it in terms of syntactic noise and to my eye makes it clearer how variables will be bound.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{sections, _acc} =
  for let {section_counter, lesson_counter} = {1, 1}, section &lt;- sections do
    lesson_counter = if section["reset_lesson_position"], do: 1, else: lesson_counter
    
    {lessons, lesson_counter} =
      for let lesson_counter, lesson &lt;- section["lessons"] do
        {Map.put(lesson, "position", lesson_counter), lesson_counter + 1}
      end
    
    section =
      section
      |&gt; Map.put("lessons", lessons)
      |&gt; Map.put("position", section_counter)

    {section, {section_counter + 1, lesson_counter}}
  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="237016" data-batch-url="/posts/batch_likers">
                        8
                      </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/introducing-for-let-and-for-reduce/44773/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-237016" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237016"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="237017" data-post-id="237017">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yeah, from the perspective of return type calling it <code>map_reduce</code> is indeed clearer. Although the proposal argues in the last section (and I also linked in the replies above) to why the variables for <code>map_reduce</code>/<code>reduce</code> should be introduced before the generators. <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"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237017" 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/introducing-for-let-and-for-reduce/44773/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-237017" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237017"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="237020" data-post-id="237020">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Oh, I’ve misunderstood the original proposal then. I thought count and sum were being reset. In that situation I would think <code>let ... for ...</code> would be the more obvious syntax but agree with the priority of not requiring new special syntax.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237020" 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/introducing-for-let-and-for-reduce/44773/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-237020" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237020"
                     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 #36"></div>
  </section>
</div>
    <div class="postbit" id="237022" data-post-id="237022">
  <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>Overall a great proposal.</p>
<h2><a name="p-237022-initialization-before-the-comprehension-1" class="anchor" href="#p-237022-initialization-before-the-comprehension-1" aria-label="Heading link" rel="nofollow"></a>Initialization before the comprehension</h2>
<p>I have doubts this should be supported.</p>
<p>I imagine those variables will be simple initial values (0, empty list, etc…), so probably their initialization code will not be that big.</p>
<p>The consequence of allowing this is that they are no longer declared and used only within the scope of <code>for_let</code> block.</p>
<p>This could be confusing to users, as somebody could try to use the let variable after the <code>for_loop</code> and could expect the value to be the same as the last one in the loop.</p>
<p>An example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; sum = 0
iex&gt; count = 0
iex&gt; for let {sum, count}, i &lt;- [1, 2, 3] do
...&gt;   sum = sum + i
...&gt;   count = count + 1
...&gt;   {i * 2, {sum, count}}
...&gt; end
{[2, 4, 6], {6, 3}}
iex&gt; sum # What is the value?
0
</code></pre>
<p>So I think it may be better if those variables can not be used (including initialized) outside of this block at all.</p>
<h2><a name="p-237022-ordering-2" class="anchor" href="#p-237022-ordering-2" aria-label="Heading link" rel="nofollow"></a>Ordering</h2>
<p>I doubt there is anything to be done about it, but I will share my impression from reading this block of code the first time.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; for let {sum = 0, count = 0}, i &lt;- [1, 2, 3] do
...&gt;   sum = sum + i
...&gt;   count = count + 1
...&gt;   {i * 2, {sum, count}}
...&gt; end
</code></pre>
<p>Here let bindings are on the first position in the first line, but they are returned as the second element in the tuple.<br>
So there is this inconsistency and I think for some users it may be not intuitive to figure out which element in the tuple should be first and which second.</p>
<h2><a name="p-237022-naming-3" class="anchor" href="#p-237022-naming-3" aria-label="Heading link" rel="nofollow"></a>Naming</h2>
<p>I am still not convinced about the name <code>let</code>. On one hand, it is short and communicates what it does. On the other hand, it means different things in other programming languages. I imagine programmers coming to Elixir and being surprised they can declare a variable with <code>let</code> only inside for comprehensions. It also could communicate to some people it can be mutating (<code>let</code> vs <code>const</code> in JavaSript).</p>
<p>Maybe reusing directly the Haskell <code>accum</code>?<br>
<code>init</code> is also interesting, especially if initialization was not allowed outside of the <code>for</code> block.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237022" 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/introducing-for-let-and-for-reduce/44773/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-237022" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237022"
                     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 #37"></div>
  </section>
</div>
    <div class="postbit" id="237023" data-post-id="237023">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I like the <code>init</code> idea.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237023" 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/introducing-for-let-and-for-reduce/44773/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-237023" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237023"
                     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 #38"></div>
  </section>
</div>
    <div class="postbit" id="237024" data-post-id="237024">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mgibowski" data-post="38" data-topic="44773">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mgibowski/48/21221_2.png" class="avatar"> mgibowski:</div>
<blockquote>
<p><code>iex&gt; sum # What is the value?</code></p>
</blockquote>
</aside>
<p>You have to assign the result of <code>for</code> so you can rebind the original variables or introduce new ones. You have a choice.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237024" 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/introducing-for-let-and-for-reduce/44773/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-237024" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237024"
                     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 #39"></div>
  </section>
</div>
    <div class="postbit" id="237028" data-post-id="237028">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mgibowski" data-post="38" data-topic="44773">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mgibowski/48/21221_2.png" class="avatar"> mgibowski:</div>
<blockquote>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; sum # What is the value?
0
</code></pre>
</blockquote>
</aside>
<p>That’s a great argument against implicit initialization from outside variables. Explicitly needing to state both the variable name for the accumulator as well as the value or variable for the initial value should be better on that front.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237028" 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/introducing-for-let-and-for-reduce/44773/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-237028" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237028"
                     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 #40"></div>
  </section>
</div>
    <div class="postbit" id="237029" data-post-id="237029">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="benwilson512" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/120/1457_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  benwilson512
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Craft GraphQL APIs in Elixir with Absinthe</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="LostKobrakai" data-post="41" data-topic="44773">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>That’s a great argument against implicit initialization from outside variables.</p>
</blockquote>
</aside>
<p>Right so just to make sure I’m on the same page, you’re saying that it should be required to:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">sum = 37
{items, sum} = for let sum = sum, ... do
  {i, sum}
end
</code></pre>
<p>Particularly the <code>sum = sum</code> bit to sort of emphasize the rebinding significance. I think I can get behind that actually.</p>
<p>I’m not really a fan of <code>init</code>. Initializing the value is only one thing that happens, the other is that it is updated to the returned value at each iteration, and <code>init</code> not only doesn’t really tell you that, but it has such an “intuitive” meaning that you’d sort of expect it to only function to set the initial value.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="237029" data-batch-url="/posts/batch_likers">
                        2
                      </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/introducing-for-let-and-for-reduce/44773/42">Post #41</a>
	                </div>
	            </div>
              <div id="likers-container-237029" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="237029"
                     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 #41"></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/44773/load_more?page=5">Load more posts (83 remaining)</a>
</div></template></turbo-stream>