<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thomas Spradling on Medium]]></title>
        <description><![CDATA[Stories by Thomas Spradling on Medium]]></description>
        <link>https://medium.com/@tjspradling?source=rss-604516820e7e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Thomas Spradling on Medium</title>
            <link>https://medium.com/@tjspradling?source=rss-604516820e7e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:17:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tjspradling/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What the heck is lambda calculus?]]></title>
            <link>https://medium.com/@tjspradling/what-the-heck-is-lambda-calculus-8e21466b87c6?source=rss-604516820e7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e21466b87c6</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[lambda-calculus]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Thomas Spradling]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 02:29:59 GMT</pubDate>
            <atom:updated>2023-07-22T20:29:06.408Z</atom:updated>
            <content:encoded><![CDATA[<p>To start, I recently got interested in how programming languages work — you know, the standard stuff like “What is a compiler?”, “How do virtual machines work?”, and some other awesome topics I’d like to touch on another time. Anyway, in doing this, I ran into this term a lot— lambda calculus — so I decided to learn more about it and will share a couple of those things here today.</p><figure><img alt="Lambda symbol in a  box drawing." src="https://cdn-images-1.medium.com/max/1024/1*6HKF00NqYPYy2ggcHVERqg.png" /></figure><h3>Motivation</h3><p>Lambda calculus is a minimal model of computation that can be used to simulate any <a href="https://en.wikipedia.org/wiki/Turing_machine">Turing machine</a>. That’s a fancy way to say it can be thought of as a <em>minimal</em> set of rules that is expressive enough to make it a programming language. In our favorite languages, we are often spoiled with if statements, while loops, arrays, recursion, arithmetic, and so many other nice things that make our lives easier as programmers. Lambda calculus can be thought as a way to simulate all of these things without actually having a lot of the features. This provided a lot of the formal background that ended up being the programming languages we now love (or hate) today. In fact, there are pretty much only three rules (actually, that’s a lie, read the <em>challenges </em>section at the end if you want to learn more precisely what these rules are):</p><ul><li>Programs are <strong>expressions </strong>(aka lambda terms or λ-terms)</li><li>Expressions can either be a <strong>named variable</strong>, a <strong>function </strong>(formally called an <strong>abstraction</strong>), or a <strong>function call</strong> (formally an <strong>application</strong>)</li><li>A function cannot call itself by name (sorry, but recursion is banned)</li></ul><p>And, that’s it. That’s all you can do in this minimal programming language. Some things you <em>cannot already do</em> include using booleans, recursion, arithmetic, or data structures. You can only create a function or a variable, or call a function. Over the next section we will show that despite these limitations, we can still construct back everything we knew and love with just functions!</p><p><em>Prerequisites:</em></p><ul><li>I assume some programming knowledge in <em>something</em></li><li>The concept of <em>currying</em>—calling a function returned from another function</li><li>(Optional) JavaScript knowledge would help since all examples are given in this language</li></ul><h3>Programming in λ-Calculus</h3><p>The most ideal choices to demonstrate the upcoming concepts would be functional languages like <a href="https://en.wikipedia.org/wiki/Lisp_(programming_language)">Lisp</a>, <a href="https://en.wikipedia.org/wiki/ML_(programming_language)">ML</a>, or <a href="https://www.haskell.org/">Haskell</a>, but to keep things simple, we’ll stick with good ol’ JavaScript. With this, the only structures we can create are expressions, which can only be one of the following:</p><ul><li>Parameters or variables like x, y, z (within function bodies). Global variables are represented as strings as in &#39;hello&#39;</li><li>Lambda (or <em>anonymous</em>) functions like x =&gt; M, where M is another expression</li><li>Calls to functions, M(N) where both M and N are expressions</li></ul><p>That’s it! For syntactic sugar, we may also name functions so we can re-use them later. We will use capitals to designate this:</p><pre>const EXAMPLE = (x) =&gt; x;<br><br>EXAMPLE(&#39;Hello&#39;)      // &#39;Hello&#39;</pre><p>But note that since recursion isn’t allowed, so don’t let the code fool you. The following is banned:</p><pre>const EXAMPLE = (x) =&gt; EXAMPLE(x);      // &lt;-- not allowed</pre><p>We simply are using this naming to make things clearer and have some resemblance of modularity. A capital naming of the above should just be thought of as the rule “replace the function definition in all places you see this name.” Since this really is a form of preprocessing, recursive concepts don’t really make sense.</p><p>Now that we’re on the same page, how can we write any programs with this? Suppose I wanted to write a function SUM that takes in a parameter n and computes 1 + 2 + ... + n . If we don’t even have numbers, how can we possibly compute or even express this? We’ll use this function as a goal to build up to. To motivate it, I’ll start by showing you an implementation we <em>would like</em> to have if we were allowed to break the rules and slowly build up to how we can create this without breaking any rules.</p><p>Rule-breaking example implementation:</p><pre>const FAKE_SUM = (n) =&gt; {<br>  if (n == 0) {              // &lt;- cannot use booleans or IF statements<br>    return 0;<br>  } else {                  <br>    return n + FAKE_SUM(n - 1);  // &lt;- cannot use numbers or recursion<br>  }<br>}<br><br>FAKE_SUM(10)  // 55</pre><p>We will now implement the fundamental parts here while following the rules: Boolean logic, a concept of numbers, and a way to emulate recursion.</p><h4><strong>Boolean API</strong></h4><p>Let’s start by considering how we can represent Booleans using <em>only</em> functions. We’d need functions for TRUE, FALSE, ITE(bool, x, y)(if-then-else), and for other applications we’d also like functions likeAND(x, y), OR(x, y), and NOT(x). The forms of TRUE and FALSE don’t really matter. We just care that ITE takes in a boolean and if it received TRUE as that boolean, return x and if it received FALSE, return y.</p><p>One way to solve this is by making both the boolean functions take in two parameters each where TRUE returns the first and FALSE returns the second. Then we can just apply these functions on the parameters x and y in the if-then-else function:</p><pre>const TRUE = (x, y) =&gt; x;<br>const FALSE = (x, y) =&gt; y;<br>const ITE = (bool, x, y) =&gt; bool(x, y);<br><br>// Intuition:<br><br>ITE(TRUE, &#39;a&#39;, &#39;b&#39;)   // -&gt; ((x, y) =&gt; x)(&#39;a&#39;, &#39;b&#39;) -&gt; &#39;a&#39;<br>ITE(FALSE, &#39;a&#39;, &#39;b&#39;)  // -&gt; ((x, y) =&gt; y)(&#39;a&#39;, &#39;b&#39;) -&gt; &#39;b&#39;<br><br>// For testing purposes, we can use strings to print the values:<br><br>TRUE(&#39;true&#39;, &#39;false&#39;)   // &#39;true&#39;<br>FALSE(&#39;true&#39;, &#39;false&#39;)  // &#39;false&#39;</pre><p>Take a moment to understand the above. Got it? Great. Now think about how you would make the AND, OR, and NOT functions.</p><p>The idea is to go left to right on each of the arguments. For the case of AND, the first time we encounter a FALSE, we need to return early. If we never encounter a FALSE, then we return TRUE. Laid out below:</p><pre>const AND = (x, y) =&gt; ITE(x, ITE(y, TRUE, FALSE), FALSE);<br>const OR = (x, y) =&gt; ITE(x, TRUE, ITE(y, TRUE, FALSE));<br>const NOT = (x) =&gt; ITE(x, FALSE, TRUE);<br><br>// Testing<br><br>ITE(AND(TRUE, TRUE), &#39;t&#39;, &#39;f&#39;)    // &#39;t&#39;<br>ITE(AND(FALSE, TRUE), &#39;t&#39;, &#39;f&#39;)   // &#39;f&#39;<br>ITE(OR(<br>  AND(FALSE, TRUE),<br>  NOT(AND(TRUE, FALSE))<br>), &#39;t&#39;, &#39;f&#39;)                      // &#39;t&#39;</pre><p>Now we have booleans, boolean expressions, and if statements! This is good enough to get some work done and even to make a text adventure game! That being said, we still have a ways to go if we wanted any substantial logic.</p><h4>Numbers API</h4><p>Now we want to represent numbers. For simplicity, we’ll consider only natural numbers as that is already fairly illustrative. Some functions we want to define:</p><ul><li>Numerals: ZERO, ONE, TWO, THREE, …</li><li>Arithmetic: INC (increment), DEC (decrement), ADD, SUB, MULT</li><li>Comparisons: ISZERO, EQUAL</li></ul><p>If we can do this, we’d be in good shape. Let’s start with the numbers. Alonzo Church considered that the <em>N</em>-th natural number (including zero) can be formally represented by using a function and mapping that function to itself <em>N</em> times. This number family is non-unique (as it depends on the generating function) and is called a <a href="https://en.wikipedia.org/wiki/Church_encoding">Church encoding</a>. We’ll then define numbers as functions with two parameters — One being some arbitrary higher-order function and another being a parameter we’ll call on (which, as all things in lambda calculus are, is still a function). This function will apply the first parameter onto the second <em>N</em> times to represent the number <em>N</em>. The syntax isn’t the best, but it will do:</p><pre>const ZERO = (f, x) =&gt; x;          // Notice that this is the same as FALSE<br>const ONE = (f, x) =&gt; f(x);<br>const TWO = (f, x) =&gt; f(f(x));<br>const THREE = (f, x) =&gt; f(f(f(x)));<br>// ...<br><br>// For testing that this works, we&#39;ll take advantage of string<br>// concatenation (which exists outside of lambda calculus) to<br>// provide a visual representation for these numbers<br>const f = (x) =&gt; x + &#39;#&#39;;<br>ZERO(f, &#39;&#39;)   // &#39;&#39;<br>ONE(f, &#39;&#39;)    // &#39;#&#39;<br>TWO(f, &#39;&#39;)    // &#39;##&#39;<br>THREE(f, &#39;&#39;)  // &#39;###&#39;</pre><p>With this in mind, we can now establish some operations. To increment isn’t too bad. We just need to turn <em>N </em>to be <em>N + </em>1. That is nothing more than calling the passed in parameter with f one more time.</p><pre>const INC = (n) =&gt; ( (f, x) =&gt; f(n(f, x)) );<br>// Think of it as taking in a function `n` (which happens to be a number)<br>// and trying to generate a new number out of it. Remember that all the<br>// are of form `(f, x) =&gt; f(...f(f(x))...)`<br><br>// Testing again using our concatenation trick<br>const f = (x) =&gt; x + &#39;#&#39;;<br>INC(TWO)(f, &#39;&#39;)                     // &#39;###&#39;<br>INC(INC(INC(INC(THREE))))(f, &#39;&#39;)    // &#39;#######&#39; or seven #&#39;s</pre><p>Decrementing is a good bit harder. More of an explanation behind the reasoning can be found <a href="https://en.wikipedia.org/wiki/Church_encoding#Derivation_of_predecessor_function">here</a>, but the result is:</p><pre><br>const DEC = (n) =&gt; (f, x) =&gt; n((g) =&gt; (h) =&gt; h(g(f)), (u) =&gt; x)(u =&gt; u);<br>//                             \_______(1)_________/  \__(2)__/ \_(3)_/<br><br>// Intuition:<br>// Assume n &gt; 0. Basic idea is to suppose:<br>// n = (f, x) =&gt; f...fff(x)<br>// n = (f, x) =&gt; f(q(x)), where q is N-1 f&#39;s<br><br>// Then, we plug (1) as f into n and (2) as x<br>// n((1), (2)) = ( (g) =&gt; (h) =&gt; h(g(f)) )(q(u=&gt;x))<br>//             = (h) =&gt; h(q(u=&gt;x)(f))<br><br>// Now we apply onto the above the identity function (3):<br>// --&gt;         = q(u =&gt; x)(f)<br>//             = q(x)      // Because u=&gt;x always maps to x<br><br>// With this our entire returned function from DEC is now:<br>// (f, x) =&gt; q(u =&gt; x)(f)<br>// (f, x) =&gt; q(x)<br><br>// We are done! q has only N-1 f&#39;s in it, so we&#39;ve decremented successfully.<br><br>// Edge case: n = ZERO = (f, x) =&gt; x<br>// In this case, when we substitute (1) and (2) into n, we get<br>// n((1), (2)) = (u) =&gt; x<br>// Applying this with identity (x =&gt; x) gives x. Thus DEC(ZERO) = ZERO.</pre><p>Phew. That was a stretch. Go take your water break and come back to finish out the main arithmetic operations.</p><p>The ADD and SUB operations are a little easier if we use the INC and DEC operators we just defined. Since each number <em>N</em> represented calls the same function on itself <em>N</em> times, we can define addition and subtraction as using <em>N</em> increments or decrements:</p><pre>const ADD = (n, m) =&gt; m(INC, n)<br>// Intuition(5, 2): TWO(INC, FIVE) = INC(INC(FIVE)) = SEVEN<br>// We really are just calling the INC on n a total of m times<br><br>const SUB = (n, m) =&gt; m(DEC, n)<br>// Intuition(4, 2): TWO(DEC, FOUR) = DEC(DEC(FOUR)) = TWO<br>// We really are just calling the DEC on n a total of m times<br>// m &gt; n, then it will just give us ZERO, aka (f, x) =&gt; x</pre><p>We can take this further with multiplication:</p><pre>const MULT = (n, m) =&gt; m((l) =&gt; ADD(n, l), ZERO)<br>// Really we are starting with zero, and adding n to it a total m times<br><br>// Example using testing function<br>const f = (x) =&gt; x + &#39;#&#39;;<br>MULT(TWO, THREE)(f, &#39;&#39;)  // &#39;######&#39;</pre><p>The last two functions we’ll create for numerals are the equality operators — to check if two numbers <em>x</em> and <em>y</em> are equal. To do this, we’ll check that both <em>x - y</em> and <em>y - x</em> and are zero (note that negative numbers don’t exist here and will always evaluate to zero). Thus we just need to find a function ISZERO. To do this, we will take advantage that only the number zero doesn’t involve the function f by making any occurences of f force the return to be FALSE.</p><pre>const ISZERO = (n) =&gt; n((x) =&gt; FALSE, TRUE);<br>// Intuition: ISZERO(ONE)<br>//      --&gt; ((f, x) =&gt; f(x))((x) =&gt; FALSE, TRUE)<br>//      --&gt; ((x) =&gt; FALSE)(TRUE) = FALSE<br>// Intuition: ISZERO(ZERO)<br>//      --&gt; ((f, x) =&gt; x)((x) =&gt; FALSE, TRUE)<br>//      --&gt; TRUE<br><br>const EQUAL = (n, m) =&gt; AND(ISZERO(SUB(n, m)), ISZERO(SUB(m, n)));<br><br>// Examples<br>ITE(EQUAL(THREE, THREE), &#39;t&#39;, &#39;f&#39;)  // &#39;t&#39;<br>ITE(EQUAL(ONE, TWO), &#39;t&#39;, &#39;f&#39;)      // &#39;f&#39;</pre><p>We now finished adding support for numbers! Our language (all built from functions) is now basically a calculator. If we wanted this calculator to be more expressive, it turns out to be possible to implement rational numbers, negative numbers, and binary numbers where we can add support for more advanced operations. I’ll leave this as good enough, but if you wanted to dive a little deeper, you can take a look at <a href="https://en.wikipedia.org/wiki/Church_encoding#Church_numerals">Church numerals</a>.</p><h4>Recursion API</h4><p>It turns out to be possible to implement recursion in functions that don’t already have support for this. This is very useful because it is well-known that every iterative algorithm (think of the most complicated algorithm you can involving while loops, for loops, and all that) can be represented via a recursive algorithm. This step is truly the piece that distinguishes calculators from true programming languages.</p><p>Suppose I have a function called STEP. This function takes in a function (as does everything) rec as an argument and returns an expression involving rec. This function STEP will be the body of our recursive function. For example, the sum function from earlier:</p><pre>// Reference to the non-lambda-calculus code from earlier:<br>const FAKE_SUM = (n) =&gt; {<br>  if (n == 0) {<br>    return 0;<br>  } else {                  <br>    return n + FAKE_SUM(n - 1);<br>  }<br>}<br><br>// STEP function now in lambda calculus<br>const ALMOST_STEP = (rec) =&gt; (n) =&gt; (<br>  ITE(ISZERO(n),<br>    ZERO,<br>    ADD(n, rec(DEC(n)))<br>  )<br>);<br><br>// Note we need to wrap ADD with an argument since JavaScript supports<br>// Eager evaluation -- meaning the arguments evaluate before body -- which<br>// doesn&#39;t hold in lambda calculus.<br><br>const STEP = (rec) =&gt; (n) =&gt; (<br>  ITE(ISZERO(n),<br>    ZERO,<br>    (f, x) =&gt; ADD(n, rec(DEC(n)))(f, x)<br>  )<br>);</pre><p>Now, we want a function FIX that calls on STEP in such as way that FIX(STEP) = STEP(FIX(STEP)). That is, a function that forces STEP to keep on calling on itself. If we had this, then we can define SUM:</p><pre>const SUM = FIX(STEP);  // = STEP(FIX(STEP)) = STEP(SUM)<br>// Intuition: SUM(ONE) = STEP(SUM(ONE))<br>// --&gt;     = ITE(FALSE, ZERO, ADD(ONE, SUM(DEC(ONE)))<br>// --&gt;     = ADD(ONE, SUM(ZERO))<br>// --&gt;     = ADD(ONE, STEP(SUM(ZERO)))<br>// --&gt;     = ADD( ONE, ITE(TRUE, ZERO, ADD(ONE, SUM(ZERO))) )<br>// --&gt;     = ADD(ONE, ZERO)<br>// --&gt;     = ONE</pre><p>Thus we just need to know such a FIX function and we’d be done. The function we’re after is called the <a href="https://en.wikipedia.org/wiki/Fixed-point_combinator"><em>Y combinator</em></a> and was discovered by none other than <a href="https://en.wikipedia.org/wiki/Haskell_Curry">Haskell Curry</a> (yep, this is the guy the language Haskell and the concept of <em>currying</em> is named after):</p><pre>const FIX = (g) =&gt; ((x) =&gt; g(v =&gt; x(x)(v)))((x) =&gt; g(v =&gt; x(x)(v)));<br>// Look at it as a function `g` mapping to a function that calls itself.<br><br>// Thus paired with STEP<br>// FIX(STEP) --&gt; ((x) =&gt; STEP(x, x))((x) =&gt; STEP(x, x))<br>//           --&gt; STEP(((x) =&gt; STEP(x, x))((x) =&gt; STEP(x, x)))<br>//           --&gt; STEP(FIX(STEP))</pre><p>And that’s it! We completely implemented recursion! Now you can go and make video games and websites out of this! To have everything in one place, here is all the code we wrote:</p><pre>// Boolean Logic<br>const TRUE = (x, y) =&gt; x;<br>const FALSE = (x, y) =&gt; y;<br>const ITE = (bool, x, y) =&gt; bool(x, y);<br><br>// Boolean Operators <br>const AND = (x, y) =&gt; ITE(x, ITE(y, TRUE, FALSE), FALSE);<br>const OR = (x, y) =&gt; ITE(x, TRUE, ITE(y, TRUE, FALSE));<br>const NOT = (x) =&gt; ITE(x, FALSE, TRUE);<br><br>// Numerals<br>const ZERO = (f, x) =&gt; x;<br>const ONE = (f, x) =&gt; f(x);<br>const TWO = (f, x) =&gt; f(f(x));<br>const THREE = (f, x) =&gt; f(f(f(x)));<br>const FOUR = (f, x) =&gt; f(f(f(f(x))));<br>// ...<br><br>// Unary operations<br>const INC = (n) =&gt; ( (f, x) =&gt; f(n(f, x)) );<br>const DEC = (n) =&gt; (f, x) =&gt; n((g) =&gt; (h) =&gt; h(g(f)), (u) =&gt; x)(u =&gt; u);<br><br>// Binary operations<br>const ADD = (n, m) =&gt; m(INC, n)<br>const SUB = (n, m) =&gt; m(DEC, n)<br>const MULT = (n, m) =&gt; m((l) =&gt; ADD(n, l), ZERO);<br>const ISZERO = (n) =&gt; n((x) =&gt; FALSE, TRUE);<br>const EQUAL = (n, m) =&gt; AND(ISZERO(SUB(n, m)), ISZERO(SUB(m, n)));<br><br>// Y combinator<br>const FIX = (g) =&gt; ((x) =&gt; g(v =&gt; x(x)(v)))((x) =&gt; g(v =&gt; x(x)(v)));<br><br>// Sum function<br>const STEP = (rec) =&gt; (n) =&gt; (<br>  ITE(ISZERO(n),<br>    ZERO,<br>    (f, x) =&gt; ADD(n, rec(DEC(n)))(f, x)<br>  )<br>);<br><br>const SUM = FIX(STEP);<br><br>// Testing<br>const FIVE = ADD(TWO, THREE);<br>const TEN = MULT(FIVE, TWO);<br>const NUM55 = MULT(FIVE, INC(TEN));<br><br>ITE(EQUAL(SUM(TWO), THREE), &#39;t&#39;, &#39;f&#39;);  // &#39;t&#39;<br>ITE(EQUAL(SUM(TEN), NUM55), &#39;t&#39;, &#39;f&#39;);  // &#39;t&#39;<br>ITE(EQUAL(SUM(TEN), ONE), &#39;t&#39;, &#39;f&#39;);  // &#39;f&#39;</pre><h3>Conclusion and Challenges</h3><p>That’s it! These are all the basics about lambda calculus. Hopefully you came out with a better appreciation for the formalities. Associated with programming languages. That being said, the things presented here don’t give a full picture. Some questions that need to be answered more formally:</p><ul><li>What does it mean to <em>evaluate</em> a function?</li><li><em>Exactly</em> under which scopes can a defined variable be used?</li><li>What does it mean to <em>define</em> (and <em>evaluate</em>) functions with two arguments when lambda calculus actually only allows the use of one?</li></ul><p>You can gain a more formal appreciation of this topic amongst any of the following resources:</p><ul><li><a href="https://en.wikipedia.org/wiki/Lambda_calculus">https://en.wikipedia.org/wiki/Lambda_calculus</a></li><li>Michael Sipher’s <em>Introduction to the Theory of Computation</em></li><li><a href="https://personal.utdallas.edu/~gupta/courses/apl/lambda.pdf">https://personal.utdallas.edu/~gupta/courses/apl/lambda.pdf</a></li></ul><h4>Challenges</h4><p>For further practice, I will give a few challenges you can try to tackle.</p><ol><li>Define lambda functions LESS_THAN and GREATER_THAN that take in two numerical parameters</li><li>Construct a 2-tuple data structure using lambda calculus. It should have the functions,</li></ol><ul><li>TUPLE(x, y) to define the tuple</li><li>GET_FIRST(t) which takes in a tuple and grabs it’s first element</li><li>GET_SEC(t) which grabs the second element of a tuple</li></ul><p>3. The recurrence fib(n) = fib(n-1) + fib(n-2) with fib(0) = 0 and fib(1) = 1 defines the <em>Fibonacci numbers</em>. Write a lambda function to find the value for fib(10).</p><p>4. Define a function FOR(n, x, y) that takes in a functional number n along with values x and y. This function should first return x a total of n (as a number) times and afterward return y. If you do this, you will have successfully created a for loop from scratch! <em>Hint: Consider using recursion and calling the (n - 1)-th iteration.</em></p><p>5. Read through <a href="https://personal.utdallas.edu/~gupta/courses/apl/lambda.pdf">this review</a> of lambda calculus and adopt their notation to try and re-write our SUM function from earlier with it.</p><p>6. Learn about α-naming and β-reduction — the two possible operations in lambda calculus — and, in the notation of Challenge 4, try to formalize the associative expressions (<em>λx y z</em>. <em>E</em>) and (<em>A B C</em>). How are these related to the JavaScript expressions (x, y, z) =&gt; E and A(B(C))? What are the differences? Look up <em>lazy evaluation</em> for some inspiration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e21466b87c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>