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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vonH" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vonH
                    <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="OvermindDL1" data-post="16" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<pre data-code-wrap="elixir"><code class="lang-elixir">params =
  params
  |&gt; Enum.map(fn {k, v} -&gt;
    v =
      case Integer.parse(v) do
        {i, ""} -&gt; i
        _ -&gt; v
      end
    {k, v}
  end)
</code></pre>
</blockquote>
</aside>
<p>How does the above code translate to English? It does something when the value <code>v</code> parses as an integer what does the</p>
<pre><code>    {i, ""} -&gt; i
    _ -&gt; v
</code></pre>
<p>sequence actually mean? What does <code>v</code> get assigned to when it parses as an integer?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29157" 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/simple-elixir-web-page-use-phoenix-or-not/4444/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-29157" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29157"
                     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 #21"></div>
  </section>
</div>
    <div class="postbit" id="29161" data-post-id="29161">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Have a look at <a href="https://hexdocs.pm/elixir/Integer.html#parse/2" rel="noopener nofollow ugc">Integer.parse/2</a>. It returns a tuple and that is what <code>case</code> is matching on.</p>
<p><code>{i,""} -&gt; i</code><br>
So if <code>v</code> happens to be a string that only contains an integer then the result from <code>Integer.parse/2</code> will match <code>{i,""}</code> - <code>i</code> being the integer that was parsed - the value that this clause evaluates to.</p>
<p><code>_ -&gt; v</code><br>
this clause is the “otherwise” or “default” clause - it simply evaluates to the value <code>v</code> that <code>Integer.parse/2</code> was trying to parse but turned out to be something else other than an “integer string”.</p>
<p>You have to realize that <a class="mention" href="/u/overminddl1" rel="nofollow">@OvermindDL1</a> worked in Erlang <em>before</em> Elixir - in Erlang you live and breathe pattern matching, so he will justifiably leverage pattern matching in Elixir to the full extent possible. Coming from an imperative background this may look a bit strange at first but more often than not, it is a very concise and declarative way of tackling (data) problems.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29161" 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/simple-elixir-web-page-use-phoenix-or-not/4444/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-29161" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29161"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="29162" data-post-id="29162">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="vonH" data-post="22" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>How does the above code translate to English?</p>
</blockquote>
</aside>
<p>Basically:<br>
For each param in the params, take the <code>k</code>ey and <code>v</code>alue, parse out the value as an integer, if the parsing is successful <code>{i, ""}</code> then return it, else return the original string <code>v</code>, then return the modified tuple <code>{k, v}</code> to a keyword list.  <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>
<aside class="quote no-group" data-username="vonH" data-post="22" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>sequence actually mean? What does v get assigned to when it parses as an integer?</p>
</blockquote>
</aside>
<p>All part of how case’s work, I’m just matching if it fully successfully parsed or if it failed to parse as an integer.  <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>
<aside class="quote no-group" data-username="peerreynders" data-post="23" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>You have to realize that <a class="mention" href="/u/overminddl1" rel="nofollow">@OvermindDL1</a> worked in Erlang before Elixir - in Erlang you live and breathe pattern matching, so he will justifiably leverage pattern matching in Elixir to the full extent possible. Coming from an imperative background this may look a bit strange at first but more often than not, it is a very concise and declarative way of tackling (data) problems.</p>
</blockquote>
</aside>
<p>I’ve even built a template-driven pattern matching framework in C++ before, I love pattern matching, succinct and powerful!  <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" 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="29162" 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/simple-elixir-web-page-use-phoenix-or-not/4444/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-29162" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29162"
                     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 #23"></div>
  </section>
</div>
    <div class="postbit" id="29181" data-post-id="29181">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vonH" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vonH
                    <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">
								<pre data-code-wrap="elixir"><code class="lang-elixir">params =
  params
  |&gt; Enum.map(fn {k, v} -&gt;
    v =
      case Integer.parse(v) do
        {i, ""} -&gt; i
        _ -&gt; v
      end
    {k, v}
  end)
</code></pre>
<p>When it comes to the params at the top of the loop can it be replaced by another variable, e.g. params2, or any other variable? I assume that the immutable nature of Elixir means that although <code>params</code> is used at the top, they are different values as the outer cannot be mutated by the inner one.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29181" 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/simple-elixir-web-page-use-phoenix-or-not/4444/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-29181" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29181"
                     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 #24"></div>
  </section>
</div>
    <div class="postbit" id="29224" data-post-id="29224">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="vonH" data-post="25" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>When it comes to the params at the top of the loop can it be replaced by another variable, e.g. params2, or any other variable? I assume that the immutable nature of Elixir means that although params is used at the top, they are different values as the outer cannot be mutated by the inner one.</p>
</blockquote>
</aside>
<p>Yep, params2 is fine, bindings (they are not variables) cannot be changed once set, what it is doing is binding a new name of <code>params</code> that is shadowing the old one.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29224" 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/simple-elixir-web-page-use-phoenix-or-not/4444/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-29224" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29224"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="29234" data-post-id="29234">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vonH" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vonH
                    <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>Which begs the question - what is a binding, is it the Elixir/functional equivalent of a variable (which it actually isn’t)?</p>
<p>What does this statement mean <code>what it is doing is binding a new name of params that is shadowing the old one</code>?</p>
<p>Does this mean that if the <code>params</code> at the top is changed to <code>params2</code>, <code>summed</code> would have to be computed with <code>params2</code>?</p>
<p>So reading it right the outer <code>params</code> gets <code>assigned</code> to the result of the inner one after the pipeline completes, and I assume the <code>Enum.map</code> function gets automatically bound to the inner params to iterate over its values.</p>
<p>With the result of the <code>map</code> as <code>{k v}</code> does it change the values of the inner <code>params</code> in situ which then gets “assigned” to the outer one, or does the <code>{k v}</code> get added to the outer <code>params</code>?</p>
<p>What is the relationship between the first pipe symbol and the variable that precedes it? Does it receive the value of the last function of the pipeline or is it simply the input of the function to the right of the pipeline symbol?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29234" 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/simple-elixir-web-page-use-phoenix-or-not/4444/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-29234" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29234"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="29236" data-post-id="29236">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="vonH" data-post="27" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>Which begs the question - what is a binding, is it the Elixir/functional equivalent of a variable (which it actually isn’t)?</p>
</blockquote>
</aside>
<p>In the Pascel/C/C++/etc… world a variable is a set of memory, it may or may not be changeable, but it is it a bit of memory able to be referenced and sized and all.  Optimization passes in the compile may elide them sometimes, but for all intents and purposes you know it is a bit of memory, usually on the stack.</p>
<p>In the (more pure) functional world, like (mostly) on the EVM/BEAM, variables do not exist, instead they have bindings.  If you set a binding to something like <code>blah = 42</code>, you do not have a bit of memory that blah is that contains 42, rather there is just ‘42’ (in this case in the constants table), and if you do <code>blorp = blah</code> then same thing, blah does not exist either, there is still only a single 42.  If you do something like <code>vweep = blorp * 2</code> then <code>vweep</code> is basically just <code>42 * 2</code>, you may not even consider it already calculated since it might not yet be, it is just a binding to ‘something’, however if you pass it to a function, like <code>zwhoo(vweep)</code> then the <code>42 * 2</code> is calculated to <code>84</code> on the stack and passed to the function.  If it is passed multiple times to multiple areas, like after the above call you then call <code>twoob(vweep, vweep)</code>, the response of <code>84</code> is not recalculated but just held on the stack and that same bit is passed to the function, only calculated once.  (Internally the BEAM does greedy calculate things, but not all functional languages do, like haskell does not).  What this means is extra memory is not used, not even pointers, so if you destructure a map like <code>%{vwoop: v} = %{vwoop: 42}</code> then the 42 in-place is used everywhere as needed, it is not necessarily copied into new memory, literally used in-place (internally of course optimizations may change this).  But you can see how this style require immutability, but allows for a lot of benefits.</p>
<aside class="quote no-group" data-username="vonH" data-post="27" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>What does this statement mean what it is doing is binding a new name of params that is shadowing the old one?</p>
</blockquote>
</aside>
<p>I’m using shadowing in the normal Pascal/C sense, the old binding still ‘exists’, but any later uses of the new name reference the new binding.</p>
<aside class="quote no-group" data-username="vonH" data-post="27" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>Does this mean that if the params at the top is changed to params2, summed would have to be computed with params2?</p>
</blockquote>
</aside>
<p>Indeed yep.</p>
<aside class="quote no-group" data-username="vonH" data-post="27" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>So reading it right the outer params gets assigned to the result of the inner one after the pipeline completes, and I assume the Enum.map function gets automatically bound to the inner params to iterate over its values.</p>
</blockquote>
</aside>
<p>Not assigned, rather it just gets bound to the operation, hence why it is called a binding, not an assignment as there may be no memory actually being allocated anywhere, even on the stack, for this.  Unsure what you mean about the <code>Enum.map</code> getting automatically bound, the only automatic binding really is function arguments in a function head…</p>
<aside class="quote no-group" data-username="vonH" data-post="27" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>With the result of the map as {k v} does it change the values of the inner params in situ which then gets “assigned” to the outer one, or does the {k v} get added to the outer params?</p>
</blockquote>
</aside>
<p>Nothing changes, ever, remember immutability, once something is set it <em>never</em> changes.  It returns a new one (internally optimized of course).</p>
<aside class="quote no-group" data-username="vonH" data-post="27" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>What is the relationship between the first pipe symbol and the variable that precedes it? Does it receive the value of the last function of the pipeline or is it simply the input of the function to the right of the pipeline symbol?</p>
</blockquote>
</aside>
<p>In all cases a <code>blah |&gt; vwoop(dreep, bloop)</code> always becomes <code>vwoop(blah, dreep, bloop)</code>.  The pipe just takes the thing before it, no matter what it is, and just puts it in the first argument position of the function, it is a very simple transformation macro.  In essence this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">42
|&gt; blah(16)
|&gt; blorp()
|&gt; vreep("bloop")
</code></pre>
<p>Is this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">vreep(blorp(blah(42, 16)), "bloop")
</code></pre>
<p>Just much more readable.  The pipe operator is popular in a huge amount of languages, mostly functional languages but it has been coming in mainstream languages for a while now too.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29236" 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/simple-elixir-web-page-use-phoenix-or-not/4444/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-29236" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29236"
                     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 #27"></div>
  </section>
</div>
    <div class="postbit" id="29239" data-post-id="29239">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vonH" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vonH
                    <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>Would it be right to say that functional programming is like an algebra exercise where you don’t have to compute the result but simply derive the formula that would compute the result, but only give the result in numbers if the exercise asks for it?</p>
<p>That would mean that lazy/delayed evaluation is what might considered to be the <code>normal</code> thing and that Erlang or Elixir’s immediate evaluation when a function is applied is simply a means of speeding things up?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="29239" 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/simple-elixir-web-page-use-phoenix-or-not/4444/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-29239" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29239"
                     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 #28"></div>
  </section>
</div>
    <div class="postbit" id="29240" data-post-id="29240">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="vonH" data-post="29" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>Would it be right to say that functional programming is like an algebra exercise where you don’t have to compute the result but simply derive the formula that would compute the result, but only give the result in numbers if the exercise asks for it?</p>
</blockquote>
</aside>
<p>That is quite accurate actually, yes.  <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>
<aside class="quote no-group" data-username="vonH" data-post="29" data-topic="4444">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/v/bc79bd/48.png" class="avatar"> vonH:</div>
<blockquote>
<p>That would mean that lazy/delayed evaluation is what might considered to be the normal thing and that Erlang or Elixir’s immediate evaluation when a function is applied is simply a means of speeding things up?</p>
</blockquote>
</aside>
<p>Precisely that.  Haskell, in comparison, is entirely lazy/delayed, but it has a <em>lot</em> of optimization passes (which makes for a very slow compiler, like C++ kind of slow) to work around it, but it makes for a fairly blazing fast language if done well.  Although OCaml is like Haskell except immediate (if you want lazy you have to decorate it yourself, which I prefer), and it compiles massive projects even faster than Elixir compiles Elixir (much faster actually), yet is fully typed and makes code within a single order of magnitude of C/C++ speed.</p>
<p>If you want to learn functional programming ‘as it is meant to be’, I recommend Haskell.  For getting non-EVM/BEAM oriented work done, I prefer OCaml.  But the EVM/BEAM and what it excels at is unmatched by anything else, especially web work.  <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="29240" 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/simple-elixir-web-page-use-phoenix-or-not/4444/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-29240" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29240"
                     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 #29"></div>
  </section>
</div>
    <div class="postbit" id="29244" data-post-id="29244">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There was recently a <a href="https://forum.elixirforum.com/t/how-do-you-refer-to-the-match-operator-when-reading-code/3561" rel="nofollow">whole topic around the bind thing</a>.</p>
<p>The other thing about functional programming is thinking of code as <em>expressions</em> rather than statements.</p>
<p>If you look carefully at the <a href="http://elixir-lang.org/getting-started/case-cond-and-if.html#if-and-unless" rel="nofollow">unless example</a> you’ll notice that the shell actually shows the evaluated value as <code>nil</code>. So while <code>unless</code> looks like a statement, it’s just a macro that either evaluates to the result of the supplied body or (implicitly) to <code>nil</code>, i.e. there always is an invisible alternative because an expression has to evaluate to <em>something</em> - even if that <em>something</em> happens to be <code>nil</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="29244" 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/simple-elixir-web-page-use-phoenix-or-not/4444/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-29244" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="29244"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></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/4444/load_more?page=4">Load more posts (1 remaining)</a>
</div></template></turbo-stream>