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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="yordisprieto" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yordisprieto/120/20915_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  yordisprieto
                    <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="peerreynders" data-post="12" data-topic="21267">
<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><img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji only-emoji" alt=":thinking:" loading="lazy" width="20" height="20"><br>
To qualify as curried I’d expect:</p>
</blockquote>
</aside>
<p>I fixed the original source code because it had just one parameter (repo) and people kept talking about curry vs partial application since a partial application with one parameter for all the functions is a curried function (from my understand).</p>
<p>Outside of that, understood, I think I have an idea of what should I do with these situations.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="122508" 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/partial-application-vs-parameters-which-do-you-prefer/21267/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-122508" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="122508"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Curried function means, that you have a function of a single arg, that returns a function of single arg and so on, until the final value is returned. You curry on the function definition site.</p>
<p>Partial application though, means to not provide all arguments right now and get a function back, which takes the remaining arguments. Partial application is done on the call site.</p>
<p>Currying in Haskell and most ML dialects is it, what makes the partial application easy and effortless.</p>
<p>In Erlang and Elixir there is neither syntactc sugar for currying nor for partial application. So the best thing we can do to partially apply a function is to use the SpecialForms <a href="https://hexdocs.pm/elixir/Kernel.SpecialForms.html#fn/1" rel="nofollow"><code>fn/1</code></a> and <a href="https://hexdocs.pm/elixir/Kernel.SpecialForms.html#&amp;/1" rel="nofollow"><code>&amp;/1</code></a> as already shown before.</p>
<p>Personally, I consider just using <code>&amp;/1</code> much easier than hand currying a function by hand and then using dotted calls everywhere, despite the fact if I want to partially apply or not.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="122534" 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/partial-application-vs-parameters-which-do-you-prefer/21267/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-122534" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="122534"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Qqwy" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Qqwy/120/1349_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Qqwy
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>TypeCheck Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Because functions are not curried by default, working with curried functions is usually non-idiomatic in Elixir. I did write a library called <a href="https://hex.pm/packages/currying" rel="nofollow">Currying</a> a while back that lets you curry arbitrary functions. However, partially applying functions in the same way as you’d do in Haskell has two problems in Elixir:</p>
<ol>
<li>It is slower because the compiler is not opitmized for these kinds of things; curried functions are not ‘built in’ and manually added currying is not removed by the compiler.</li>
<li>In great contrast to both Haskell and Erlang, in Elixir, the ‘most important argument’ is usually the <em>first</em> argument, rather than the <em>last</em>: when partially applying a function, this is usually the thing we want to fill in last, which does not work well when working with currying-based partial application.</li>
</ol>
<p>However, partial application based on the two super-helpful special forms that <a class="mention" href="/u/nobbz" rel="nofollow">@NobbZ</a> already mentioned as well (<code>fn</code> and <code>&amp;</code>) is <em>super</em> helpful, very idiomatic and widely used in practice.</p>
<hr>
<p>I do not think there exists a battle between parameters on one hand and partial application on the other: Whenever we <em>use</em> a function, this is where we decide whether we want to fill in all parameters at once, or still keep a couple of them blank (which we can do using <code>fn</code>, <code>&amp;</code>, and/or wrapping the actual function we want to call in a new, descriptively named function). This is a decision for the <em>consumer</em> (the place the function is called) of the code, not the producer (the place the function is defined).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="122536" 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/partial-application-vs-parameters-which-do-you-prefer/21267/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-122536" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="122536"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>