<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>JMCT on Functional Programming</title>
    <link href="http://jmct.cc/atom.xml" rel="self" />
    <link href="http://jmct.cc" />
    <id>http://jmct.cc/atom.xml</id>
    <author>
        <name>JMCT</name>
        <email>jmct@jmct.cc</email>
    </author>
    <updated>2024-10-06T00:00:00Z</updated>
    <entry>
    <title>My Experience With Operation Airdrop</title>
    <link href="http://jmct.cc/opairdrop/index.html" />
    <id>http://jmct.cc/opairdrop/index.html</id>
    <published>2024-10-06T00:00:00Z</published>
    <updated>2024-10-06T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>My Experience With Operation Airdrop</h1>
<h3>Oct  6, 2024</h3>
<h1 id="introduction-and-context">Introduction and Context</h1>
<h2 id="disclaimer">Disclaimer</h2>
<p>I have been increasingly frustrated with the narrative online about what’s goig with Hurricane Helene relief efforts w.r.t. civilian aviation. This is my personal experience with flying an aid mission, I do not speak for anyone else or any organization, others may have had other experiences.</p>
<h2 id="why-light-aircraft">Why Light Aircraft?</h2>
<p>Helene caused bridges to collapse and many roads to be washed away. Trucks are the most efficient way to transport supplies/goods, but only if they can actually reach the destination. As roads were being cleared or alternative paths being built, light aircraft are able to fly into more remote areas and deliver supplies. The United States has the largest civilian aircraft fleet in the world, and it’s beginning to be more common to leverage this fleet after a natural disaster.</p>
<p>The aircraft that I fly is designed for flight into short runways/strips, and can even be used for ‘off airport’ operations, so I decided I would try and help.</p>
<h2 id="context-about-flying-and-air-traffic-control">Context about Flying and Air Traffic Control</h2>
<p>In aviation there are a few different ‘flight categories’. <em>Visual Meteorological Conditions</em> (VMC) mean that you are able to navigate by visual references to the ground, sky, and horizon. There are ‘objective’ standards by which VMC is judged, the visbility must extend a certain distance, the cloud ceiling cannot be too high, etc. Another common category is <em>Instrument Meteorological Conditions</em> (IMC), which means that flight <em>cannot</em> be accomplished by visual references and must instead be accomplished ‘by reference to instruments’ in the cockpit.</p>
<p>Those are the categories as determined by the weather, there are also <em>regulations</em> that determine how you need to fly (distance to clouds in different airspaces, do you need to be talking to ATC, etc.). You can fly by the <em>Visual Flight Rules</em> (VFR) only in VMC. You can fly by the <em>Instrument Flight Rules</em> (IFR) in VMC or in IMC. You might choose to fly IFR in VMC for practice or because of the additional support you get from ATC, etc.</p>
<p>Lastly, if you’re flying by VFR you often don’t have to talk to ATC unless you want to, you’re expected to ‘see and avoid’ other aircraft. If you want to, and if they have the capacity, it can often be beneficial to be talking to them as they see the bigger picture of who is going where and can help you avoid other aircraft/warn of know weather issues/etc.</p>
<p>Things were so busy in Western North Carolina that unless you’re part of the relief effort, ATC didn’t have enough capacity to talk to everyone that wanted to talk to them. At one point they weren’t even able to help with IFR flights, which means that if the weather is not VMC, you can’t take off and are stuck on the ground until they have the capacity to talk to you or the weather becomes VMC.</p>
<h1 id="relief-efforts-in-nc">Relief Efforts in NC</h1>
<h2 id="dispatch">Dispatch</h2>
<p>So I fly down there Friday morning from DC. While I was still in DC airspace I tell ATC where I’m going, they know from context that I’m heading down to help with the relief effort. ATC was overwhelmingly accommodating. Every step of the way they were helping aircraft get to where they needed to go. When I got to the airspace near the relief effort it was busier than any airspace I have ever flown in.</p>
<p>The organization I’m working with has a supply hub, near Charlotte, that had been spared the worst of the storm but was still near enough to the Appalachians to fly supplies in where they are needed. By this stage of the relief efforts things were fairly well-oiled.</p>
<p>I land at the supply hub, they only asked three bits of information:</p>
<ul>
<li>My tail number</li>
<li>the type of aircraft</li>
<li>How much cargo (weight) I can take</li>
</ul>
<p>Because the aircraft I fly is able to land in tighter spots, the dispatcher (person figuring out who should go where) asked whether I was comfortable going to an airport that was a bit trickier, and had therefore received fewer supply runs. My co-pilot and I spent some time looking up the airport; its runway lengths, its elevation, and determined that while tricky we were comfortable with the mission.</p>
<p>Dispatch was trying to get supplies to where they were needed, they used this whiteboard to keep track of who needed what:</p>
<figure>
<img src="/images/opairdrop/dispatch-site-requests.jpeg" title="Status of Specific Requests at different places" alt="Request for specific items at different airports" width="500" /><figcaption>Request for specific items at different airports</figcaption>
</figure>
<p>You can kinda tell from the photo above which areas were further along in their recovery. Because communications were often cut off (depended on the area), a lot of this information was relayed by the pilots returning from supply runs.</p>
<p>Similarly runway/weather/airport conditions were tracked as well:</p>
<figure>
<img src="/images/opairdrop/airport-conditions.jpeg" title="Conditions at various airports" alt="Airport Conditions" width="500" /><figcaption>Airport Conditions</figcaption>
</figure>
<p>Not every airport is there (mine wasn’t) because this dispatcher hadn’t yet received word (it turns out that other orgs <em>had</em> made supply runs there, this dispatcher just hadn’t known about that).</p>
<p>Volunteers had pre-weighed pallets of supplies. Depending on where you were going and how much you could carry, you’d pick a pallet to be loaded into the aircraft. Volunteers helped at each stage of this process, including loading the cargo.</p>
<p><strong>At no point did anyone from the FAA or FEMA get in the way of this process (a claim being made online).</strong></p>
<h2 id="supply-run">Supply Run</h2>
<p>The tower at the supply hub was so wildly busy and they were working magic. They did a fantastic job of getting everyone off the ground in a timely manner. As one aircraft was waiting on an IFR clearance, and they had me taxi through the grass in order to depart earlier since I was flying VFR. Not really the behavior of someone trying to prevent people from helping.</p>
<p>On the way to my destination ATC was great again. The approach and landing went as briefed, we had to descend into a valley, which is always a bit spooky as it means there is terrain higher than you as you come in for a landing, leaving you with fewer options if things go poorly. While it was uneventful, the pre-planning was absolutely necessary as it was tricky and full of obstacles.</p>
<p>The folks on the ground there helped me unload the plane and had special requests for aid. They asked me to communicate those requests back to dispatch. On the way back to the supply hub I had a very close call with another aircraft<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>. Normally ATC would have given me a heads up, but they were so swamped. Weather was getting worse too, which caused congestion of VFR aircraft since we all had to find visual paths around clouds and holes through layers for descent.</p>
<p>Unfortunately the weather prevented further supply runs to that area. Luckily (though I did not know this at the time), the roads opened up to that area later that day, which is great news.</p>
<p>The issues on the ground are that the infrastructure has been destroyed, communication is difficult, and the environment is changing all the time: some roads reopen, which shifts where aircraft are actually needed, etc. All of these are difficult coordination problems and there are many cooks in the kitchen; all well-meaning and all trying their best.</p>
<p>I want to reiterate because it’s by far the largest discrepancy between what I experienced and what I’m reading on the internet: <strong>at no point was the government ‘in my way’</strong>. It’s just a very difficult overall situation! When ATC closes off a part of airspace it’s not to prevent people from trying to help, it’s because when the weather is getting worse they have to close off airspace so that larger supply aircraft can navigate safely without risk of midair collision.</p>
<p>I was sad that I could not do more, and that I hadn’t gone earlier in the week. That said, it was gratifying to be able to help, even if it was a small help.</p>
<p>I have immense respect for those working ATC and folks doing supply runs over multiple days.</p>
<figure>
<img src="/images/opairdrop/hat.jpeg" title="Operation Airdrop Hat" alt="They gave me a hat" width="500" /><figcaption>They gave me a hat</figcaption>
</figure>
<p>-JMCT</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>I have since filed a NASA ASRS report about the incident to help prevent similar incidences in the future.<a href="#fnref1" class="footnote-back">↩</a></p></li>
</ol>
</section>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>
<entry>
    <title>Quick and Dirty Mirroring for Historians</title>
    <link href="http://jmct.cc/qada/index.html" />
    <id>http://jmct.cc/qada/index.html</id>
    <published>2022-03-07T00:00:00Z</published>
    <updated>2022-03-07T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>Quick and Dirty Mirroring for Historians</h1>
<h3>Mar  7, 2022</h3>
<h1 id="introduction">Introduction</h1>
<p>It’s possible that Russia will disconect or be disconnected from the global internet, with some reports saying that this will occur by Friday. I am unsure how likely this is, but they have practiced this <a href="https://www.bbc.com/news/technology-50902496">in the past</a>. Regardless, lots of folks who depend on Russian websites and resources for their work are a reasonably concerned. This is a very rough guide to how you might be able to download those resources for your own use offline.</p>
<h2 id="disclaimer">Disclaimer:</h2>
<p>We’re going to skip over a lot of the <em>why</em>, we’re doing the things I describe below. Normally, I’d want to motivate it and ensure that you’re all empowered by understanding the tools you’re using, but there isn’t time for that today, maybe another time.</p>
<h1 id="get-wget">Get <code>wget</code></h1>
<p>You’ll need <code>wget</code>, which is a tool for ‘getting’ resources from the web.<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a></p>
<h2 id="mac">Mac</h2>
<p>If you’re on a Mac, the easiest way is to open up <code>Terminal</code> (use spotlight to open up the terminal) and type the following command:</p>
<pre><code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</code></pre>
<p>Once that finishes, check that it worked by running the following (the dashes, (<code>--</code>) matter):</p>
<pre><code>brew --version</code></pre>
<p>If you get back something along the lines of “brew not found” then the command didn’t work. I’m sorry. You can try emailing me, but it’s going to be hard to figure out what went wrong remotely. If you got back a message saying what version you’re running, great! Run the following:</p>
<pre><code>brew install wget</code></pre>
<p>Once that is complete, we’re going to do a similar test to see if it worked:</p>
<pre><code>wget --version</code></pre>
<p>If you get something like <code>command not found</code>, it didn’t work. I’m sorry. Otherwise, you’ve now installed <code>wget</code>, which is the main tool we need. Skip to “Using wget”.</p>
<h2 id="windows">Windows</h2>
<p>If you’re on Windows, <a href="https://eternallybored.org/misc/wget/">this site</a> seems to be the most straightforward way of getting <code>wget</code> running on your system. I do not have a Windows system to test this, unfortunately. If you have issues, reach out to me and I can clarify this section with more details.</p>
<h1 id="using-wget">Using <code>wget</code></h1>
<p>Having installed <code>wget</code> we can now mirror (a.k.a. clone) some webpages. The distinction between which webpages this will work on and which it will not, are well beyond the scope of this post. For now, just try it. The worst case is that it won’t work. You’re unlikely to break anything.</p>
<h2 id="testing-a-single-page">Testing a single page</h2>
<p>One of the issues of using <code>wget</code> is that you may accidentally bite off more than you chew, webpages can be very large and your local storage may not be big enough. Additionally, the bigger the webpage, the longer this will take, with no guarantee that it’ll work when it’s completed its job. Because of this, it’s important to test it on a small part of what you care about.</p>
<p>For example, if you wanted to mirror this website of a <a href="http://zhurnalko.net/journal-204">Russian and Soviet Journal</a>, it will be wise to try and see if you can mirror one issue first. So let’s try to mirror <a href="http://zhurnalko.net/=sam/junyj-tehnik/2007-01">the first issue from 2007</a>. Below is the command that will try to mirror this particular page, but before you copy/paste it, read a little bit further so that you know how to change it to your needs:</p>
<pre><code>wget --mirror --convert-links --adjust-extension --page-requisites --no-parent -l 1 http://zhurnalko.net/=sam/junyj-tehnik/2007-01</code></pre>
<p>Everything from the <code>wget</code> to the <code>--no-parent</code> can be taken as a given for our ‘Quick and Dirty’ explanation.</p>
<p>The two important things for you are the following:</p>
<ul>
<li><code>-l SOME_NUMBER</code></li>
<li>The URL (<code>http://zhurnalko.net/=sam/junyj-tehnik/2007-01</code>, in this case)</li>
</ul>
<p>The <code>-l</code> represents <em>how deep</em> we want this mirror to go. You never want this number to be very high as it’ll try to download non-trivial portions of the internet. I’ve never used a number larger than <code>-l 5</code>, for instance and that can still take many many hours. Here we’ve started with <code>-l 1</code> because we want this exact page <em>and to follow each link on this page</em>, the ‘1’ means “only go one page deeper”. Don’t ever use <code>-l 0</code> though as that means ‘infinite’, which you don’t want, I promise.</p>
<p>The URL is the page we want to start from, in this case the first issue of 2007.</p>
<p>Now, when you run the command, it may take a bit of time. Just be patient, don’t put your computer to sleep or turn it off, or close your terminal/command prompt. Just let it do it’s thing. At some point, it will finish and you may get a message like the following:</p>
<pre><code>Converted links in 87 files in 0.02 seconds.</code></pre>
<p>Here, the <code>0.02</code> seconds is not for the overall process, but for the final step in making it available offline. The overall process took me about 5 minutes for this particular page.</p>
<h2 id="viewing-the-mirrored-site">Viewing the mirrored site</h2>
<p>Unfortunately, this next part is going to be a bit different for each webpage. There’s not universal standard. I’ll try to explain what you’re looking for via our running example.</p>
<p>You’ll have a folder hierarchy that matches the URL you mirrored. In this case that means we’ll have a folder called <code>zhurnalko.net/</code>, and in the folder will be a folder called <code>=sam/</code>, which will have a folder called <code>junyj-tehnik/</code>. In that folder you’re going to look for something that is potentially called <code>index.html</code>, or <code>index.htm</code>. Sometimes, as is the case in our running example, it’s named the same as the <em>last</em> part of the URL: <code>2007-01.html</code>, in this case.</p>
<p>If you try to open that (double click on it), you should be able to view the files.</p>
<h2 id="grabbing-a-bit-more">Grabbing a bit more</h2>
<p>Once you’re satisfied that the mirroring works, you can try to mirror a bit more of the website. This will require you going ‘up’ a level in the website, and adding 1 to the <code>-l</code> value you used. Remember, if that value starts getting large (you should consider 3 or greater to be large!), you’re trying to mirror too much and need to find a way to be more targeted.</p>
<p>In the case of the site we’re trying to mirror, one level up would be <code>http://zhurnalko.net/journal-204</code>, which has all the issues of that journal. We would then add 1 to <code>-l</code> and it would look like the following:</p>
<pre><code>wget --mirror --convert-links --adjust-extension --page-requisites --no-parent
-l 2 http://zhurnalko.net/journal-204</code></pre>
<p>To say that this could take significantly more time is an understatement. I ran the above over an hour ago and it’s still chugging along!</p>
<p>Once it completes its job, you’re going to want to find that initial page (see “Viewing the mirrored site” above) and you’re all set to use those files offline.</p>
<p>-JMCT</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>This is an unusually clear name for modern software!<a href="#fnref1" class="footnote-back">↩</a></p></li>
</ol>
</section>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>
<entry>
    <title>PLMW @ ICFP 2021</title>
    <link href="http://jmct.cc/plmw/index.html" />
    <id>http://jmct.cc/plmw/index.html</id>
    <published>2021-08-06T00:00:00Z</published>
    <updated>2021-08-06T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>PLMW @ ICFP 2021</h1>
<h3>Aug  6, 2021</h3>
<p>This year, <a href="https://users.soe.ucsc.edu/~lkuper/">Lindsey Kuper</a> and I are co-chairing the <a href="https://www.sigplan.org/Conferences/PLMW/">Programming Languages Mentoring Workshop (PLMW)</a> at ICFP 2021. The deadline to <a href="https://icfp21.sigplan.org/home/plmw-icfp-2021#Apply-Now">apply</a> is August 8th, right around the corner.</p>
<p>If you’re someone that is curious about a career in a Programming Language-related field (whether that takes the form of attending graduate school, working in an industrial research lab, working on compilers/dev tools, or working in academia) I’d like to make a case for you to attend PLMW.</p>
<p>Many have made plenty of compelling cases before: Lindsey has a great <a href="http://composition.al/blog/2020/07/20/yet-another-post-telling-you-to-apply-to-plmw/">post</a> regarding last year’s event and many of those same points apply to this year’s iteration.</p>
<p>My case is slightly different than many of the discussions I’ve seen online, but before I get to it, I should state that my premise is based on the idea that research is a social process and activity. If you disagree with this premise, then I doubt you’ll be convinced by this post.</p>
<h1 id="good-research-is-good-communication">Good Research is Good Communication</h1>
<p>Many of us pursue research ideas because we find them interesting or important or both (when the planets align). While it’s becoming more and more rare, it’s possible that a work of research is carried out alone by an individual and written up by that same individual. Once that paper is submitted though, the work leaves the realm of the individual and gets thrust into the sometimes arcane set of social processes, norms, and conventions of peer review. You are no longer a lone researcher exploring the wilderness of ideas, you have made your journey and now you must communicate what you’ve seen. This is hard.</p>
<p>Communicating ideas, particularly <em>new</em> ideas, is made more difficult when we don’t know <em>who</em> we are communicating with. By ‘who’ I don’t mean their identity, necessarily, but their general context and mental map of the world. As such, it’s important for researchers to attain a good working model of how their peers go about their work, what their peers find interesting, and what problems their peers are facing.</p>
<p>In programming languages we do this in several ways, but in my opinion the main two methods are:</p>
<ol type="1">
<li>Reading Papers written by our peers</li>
<li>Talking with our peers, directly</li>
</ol>
<p>Conferences (or workshops, etc.) are great for the latter, especially if you already have a good mental map of who works on what and what the current techniques are. But if you’re trying to <em>build</em> that mental map, conferences can be quite intimidating!</p>
<h1 id="plmw-as-map-making">PLMW as Map Making</h1>
<p>In my view, PLMW is an on-ramp for making these mental maps of the community. No workshop will be able to just provide you with a fully up-to-date social graph of the community – everyone’s would be different anyway – but PLMW is designed to be a way for incipient researchers (and those curious about the field) to</p>
<ul>
<li>see what some of the current topics in the field are: Brigitte Pientka’s talk “Introduction to Mechanized Metatheory”<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a></li>
<li>learn how we communicate our ideas with each other: Derek Dreyer’s talk “How to Write Papers So People Can Read Them”</li>
<li>discuss how we do research without knowing it all: the “I don’t get it” panel</li>
<li>hear how to navigate explicit collaborative relationships, such as the relationship between a student and their advisor: Amal Ahmed’s talk “Managing Your Research, Your Advisor, Your PhD”</li>
<li>think about how our research can have an impact on the world: Mike Hick’s talk “Increasing the Impact of PL Research”</li>
<li>learn to view ourselves as emotional beings: Aaron Turon’s talk “Emotional Machines”</li>
</ul>
<p>All of these topics involve social processes in some way, most do so directly.</p>
<p>We will also have small-group mentoring meetings so that you can ask more senior community members questions about doing work in the field, they are there to help you build your own map, so asking questions like “I’m interested in X, are there people/groups/etc. that look into X?”, or “I tried reading a paper on Y but I couldn’t understand it, what should look into in order to get the most out of that paper?” is the whole point!</p>
<p>PLMW may not be necessary for you, I won’t claim it’s necessary to attend PLMW, but everyone is welcome.</p>
<p>-JMCT</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>I personally know very little about Metatheory, so I’m very excited to learn from Brigitte on this topic!<a href="#fnref1" class="footnote-back">↩</a></p></li>
</ol>
</section>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>
<entry>
    <title>1: Expressions</title>
    <link href="http://jmct.cc/1/index.html" />
    <id>http://jmct.cc/1/index.html</id>
    <published>2017-01-09T00:00:00Z</published>
    <updated>2017-01-09T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>1: Expressions</h1>
<h3>Jan  9, 2017</h3>
<h1 id="preface">Preface</h1>
<p>Welcome to part 2 of <a href="http://jmct.cc/burge.html">“The Burge School of Functional Programming”</a>. <a href="http://jmct.cc/intro/index.html">Last time</a> I claimed that Burge’s 1975 book “Recursive Programming Techniques” is a gem of Functional Programming that deserves to be more widely known. Burge’s book gets to the core of what Functional Programming is about, and it’s not fancy type systems or mathematical jargon; it’s <em>expressions</em>. This post is where we really pinpoint what an expression is. If I’m going to convince you that functional programing is about expressions, we should be really clear what we mean by that!</p>
<p>In later posts we’ll look at how to build up an entire programming language from what’s described here, and how that reflects one of the great ideas in Functional Programming: constructing software systems from <em>small</em> expressions that can be understood <em>in isolation</em>.</p>
<p>Throughout this series, I will use the notation that Burge used. However, I aim to point out when those notations differ from modern conventions.</p>
<p>I’m going to quote directly from the book a lot early on in this post, as I feel there’s a lot of insight to be found at the beginning of Burge’s first chapter.</p>
<h1 id="introduction">Introduction</h1>
<p>Burge hits the ground running with the introductory chapter of the book, making it clear that the style of programming this book advocates is a bit different from what the reader may be used to. On the very first page he states:</p>
<blockquote>
<p>All the linguistic devices introduced [in this book] are based upon two methods of constructing expressions from smaller expressions […] Thus the extra notation that is added to this basis adds no new structural features</p>
</blockquote>
<p>He names the extra notation <em>additions</em>. These days we would call it <em>syntactic sugar</em>, but the idea is identical: New forms of expression that can be translated to a few core constructs. Let that sink in: all of the language constructs that Burge describes in his book can be rewritten with just the two following constructs:</p>
<ol type="1">
<li>“An operator/operand construction that denotes function application”</li>
<li>“An expression format which denotes a function”</li>
</ol>
<p>Burge does remind the reader that there will be some ‘constants’ (we’d call them <em>primitives</em>) required for certain tasks. This sets up one of the first great insights of the text, stating that the constructs</p>
<blockquote>
<p>create a practical and powerful programming system, which is more like a <em>family</em> of programming languages than a single language, because the features introduced are concerned more with combining functions to produce new ones than with the nature of the primitive functions that are being combined.</p>
</blockquote>
<p>Here comes the kicker:</p>
<blockquote>
<p>A programming language for a particular range of applications can be obtained by adding an appropriate set of primitives to this basic structure.</p>
</blockquote>
<p>These days we call a “language for a particular range of applications” a Domain Specific Language (DSL). DSLs are a very powerful tool in the functional programmer’s toolbox. So in just under a page Burge has set the stage for understanding functional programming through just a few core constructs and its usefulness in creating <a href="https://en.wikipedia.org/wiki/Domain-specific_language">DSLs</a> but avoids using any jargon. So Burge’s lesson so far: understand two core constructs, then pick primitives according to your domain.</p>
<p>We haven’t gotten much further in the decades since.</p>
<p>He’s not done yet, there’s one more insight waiting for us, right before he starts introducing the core constructs he reminds us that the focus is on <em>expressions</em> and not <em>mechanisms</em>. He argues that expressions have a great property:</p>
<blockquote>
<p>the value, or meaning, of an expression depends in a simple way only on the values of its subexpressions and on no other properties of them.</p>
</blockquote>
<p>So again, without leaning on fancy language, Burge lays it all out in front of us. He states that this property allows you solve large and complex problems by breaking them down into small, simple, and independent problems. And</p>
<blockquote>
<p>it is possible to make the structure of the program match the structure of the problem being solved.</p>
</blockquote>
<h1 id="the-language">The Language</h1>
<h2 id="operatoroperand-expressions">Operator/Operand Expressions</h2>
<p>Let’s start with the obvious: Functional Programming deals with functions. This makes it critical to specify what we mean when we say <em>function</em>. Burge does this by talking about the relationship a function has to its arguments. More specifically, he talks about types, starting with function types.</p>
<p>But remember, this is a book from decades ago, so we’re not bringing in any heavy machinery here. Note that Burge never talks about type-checking or even implementing a type system. Even if your compiler doesn’t do type checking, you can still benefit from thinking about types.</p>
<h3 id="functions-and-types">Functions and types</h3>
<p>I’ve been going on about <em>expressions</em> over <em>mechanisms</em> for a while and I haven’t even shown you an expression yet. So let’s take a look at one: <span class="math inline">\(f(x)\)</span>. This is how Burge typesets the application of the function <span class="math inline">\(f\)</span> to the value <span class="math inline">\(x\)</span>. This is the first expression we’ve seen, so let’s unpack it. <span class="math inline">\(f(x)\)</span> is a function application, which has two parts; an <em>operator</em> (in this case <span class="math inline">\(f\)</span>), and an <em>operand</em> (in this case <span class="math inline">\(x\)</span>). This makes function application a type of <em>compound</em> expression.</p>
<p>In the introduction I claimed that all of the language constructs we will introduce can be understood with just two concepts; function application is the first one! The basic idea of looking at application as a compound expression is that in order to make sense of the expression <span class="math inline">\(f(x)\)</span> you’re going to have to make sense of <span class="math inline">\(f\)</span> and of <span class="math inline">\(x\)</span>. That may seem obvious, but the insight Burge is trying to get across to you is that when you program in this expression-based style you make sense of each in isolation. That’s a very powerful idea!</p>
<p>Okay, so a function is a value that you can <em>apply</em> to other values (a.k.a. the inputs). However, not all values make sense as inputs; for example, the function <span class="math inline">\(square\)</span> that takes a number and multiplies it by itself, does not make much sense if you give it the letter ‘a’ as an input. Let’s be a bit more concrete and say functions have a <em>type</em>, usually written as</p>
<p><span class="math display">\[A \longrightarrow B\]</span></p>
<p>Here the <span class="math inline">\((\rightarrow)\)</span> is what indicates this is a function. The <span class="math inline">\(A\)</span> is the type of value it accepts, and <span class="math inline">\(B\)</span> is the type of values it returns. Burge calls these the <em>domain</em> and <em>range</em>, respectively.<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> So if you have a function <span class="math inline">\(f\)</span> of type <span class="math inline">\(A \rightarrow B\)</span>, and you apply it to a value <span class="math inline">\(x\)</span> which has type <span class="math inline">\(A\)</span>, the result is of type <span class="math inline">\(B\)</span>. Burge typesets function application as both <span class="math inline">\(f(x)\)</span> or <span class="math inline">\(f\ x\)</span>.</p>
<p>Earlier I mentioned the function <span class="math inline">\(square\)</span>. One possible type for <span class="math inline">\(square\)</span> would be<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a></p>
<p><span class="math display">\[square \in (\text{integer} \rightarrow \text{integer})\]</span></p>
<p>Other common examples:</p>
<p><span class="math display">\[ 
sin \in (\text{real} \rightarrow \text{real}) \\
log \in (\text{positive} \rightarrow \text{real}) \\
negate \in (\text{positive} \rightarrow \text{negative})
\]</span></p>
<p>So in general anything of the form <span class="math inline">\(g \in (A \rightarrow B)\)</span> is an assertion that <span class="math inline">\(g\)</span> is a function that takes arguments of type <span class="math inline">\(A\)</span> and returns values of type <span class="math inline">\(B\)</span>. This means if we have a value <span class="math inline">\(x\)</span> of type <span class="math inline">\(A\)</span>, we can be assured that <span class="math inline">\(g(x) \in B\)</span>.</p>
<p>Okay, this is all well and good, but every function we’ve looked at takes only a single argument, what about things like <span class="math inline">\(+\)</span>? Here are some examples:</p>
<p><span class="math display">\[
+ \in (\text{real} \times \text{real} \rightarrow \text{real})\\
min \in (\text{real} \times \text{real} \rightarrow \text{real})\\
equal \in (\text{real} \times \text{real} \rightarrow \text{truth value})
\]</span></p>
<p>This is just saying that these functions take two arguments, both reals, and return a single value. This generalizes in the obvious way to functions with an arbitrary number of arguments. So a function that takes <span class="math inline">\(N\)</span> arguments would have a type like</p>
<p><span class="math display">\[A_{1} \times A_{2} \times \dots \times A_{N} \rightarrow B\]</span></p>
<p>Where <span class="math inline">\(A_{i}\)</span> is the appropriate type of the <span class="math inline">\(i^{th}\)</span> argument. In other words, <span class="math inline">\(A \times B\)</span> defines the type of <em>pairs</em> where the first element is of type <span class="math inline">\(A\)</span> and the second element is of type <span class="math inline">\(B\)</span>.</p>
<p>Now, the traditional way to apply functions that take multiple arguments is by extending the syntax we already have, giving us <span class="math inline">\(min(x,y)\)</span> or <span class="math inline">\(+(x,y)\)</span>. Many languages have a predetermined set of special functions that can be applied differently, the arithmetic operations are usually such an exception, so you could write <span class="math inline">\(x + y\)</span> instead of <span class="math inline">\(+(x,y)\)</span>. Burge is no different here and his language allows for certain functions to be applied in this special manner.</p>
<p>It’s worth pointing out that even if you have a special syntax for the application of certain functions, <em>the operator/operand relationship is unchanged</em>. It could be argued that allowing any such special syntax obscures this relationship and therefore obscures the meaning of the expression<a href="#fn3" class="footnote-ref" id="fnref3"><sup>3</sup></a>. The important bit is that regardless of the syntax it is crucial that you be able to identify the operator and the operand of a function application.</p>
<h3 id="quick-aside-about-types">Quick aside about types</h3>
<p>This is pretty much the extent of what we’ll say about types, possibly for the whole series. Though types are used to describe things (as we’ll see in the next section), Burge never defines a type system, or any form of static enforcement of types. So why mention types at all? Because it’s important to <em>think</em> about types when you’re doing functional programming, particularly to distinguish between things that you can apply (functions), what they expect as argument values, etc.; and things you can’t apply (the number <span class="math inline">\(5\)</span>, for instance).</p>
<p>Many of the experts of dynamic languages I’ve interacted with will be the first to tell you: thinking about types is important when writing programs. But we don’t have to get fancy with our type system in order to have any benefit from the <em>concept</em> of types.</p>
<h3 id="meaning-of-expressions">Meaning of expressions</h3>
<p>We now know what makes up a function application (the operator and operand), but we still don’t know the <em>meaning</em> of anything. I claimed earlier that you can determine the meaning of a function application by finding the meaning of its operator and operand. But eventually you’ll reach an expression that is not a function application, Burge calls these <em>simple</em> expressions. In this section we will explain the meaning of one type of simple expression: <em>constants</em> (variables are the other type of simple expression, which we’ll get to a bit later).</p>
<p>In any programming system there is a set of constants (what we would call primitives). The meaning of these constants is given by the system and its implementation. The most obvious constants are things like numbers: <span class="math inline">\(4\)</span>, <span class="math inline">\(-128\)</span>, etc.<a href="#fn4" class="footnote-ref" id="fnref4"><sup>4</sup></a> or arithmetic operations: <span class="math inline">\(+\)</span>, <span class="math inline">\(-\)</span>, <span class="math inline">\(\times\)</span>, etc.</p>
<p>So if your language has the constant <span class="math inline">\(+\)</span> which takes two numbers and adds them together, and it has numeric constants we can now find the meaning of expressions like <span class="math inline">\(+(4,5)\)</span>, or <span class="math inline">\(square(\times(2,3))\)</span>.</p>
<p>We do this with the following procedure:</p>
<ol type="1">
<li>If the expression is simple, what is the meaning of the constant?</li>
<li>If the expression is composite, what is the meaning of its operator, and what is the meaning of its operand?</li>
</ol>
<p>Try applying this series of steps to <span class="math inline">\(+(4,5)\)</span>, or <span class="math inline">\(square(\times(2,3))\)</span>. Do yourself a favor and force yourself to actually go through the steps. In this instance it is not very hard, but it is the practice of finding the meaning of expressions via the meaning of their constituent parts that is important.</p>
<p>For the rest of the post we’ll allow ourselves to use the arithmetic operators as <a href="https://en.wikipedia.org/wiki/Infix_notation">infix</a>, i.e. <span class="math inline">\(4 + 5\)</span>.</p>
<h3 id="what-it-means-to-be-first-class-or-functions-are-values-too">What it means to be first-class; or, functions are values too!</h3>
<p>Burge uses two conventions when writing function application. The first is what we’ve seen up to this point: <span class="math inline">\(f(x)\)</span> or <span class="math inline">\(f(x,y)\)</span>. This is very common and is likely to be what most languages you’re familiar with use. The second convention Burge uses is more unusual: <span class="math inline">\(f\ x\)</span> or <span class="math inline">\(f\ x\ y\)</span>, respectively. Burge explains that these aren’t really different syntaxes for function application, but really represent functions of different types!</p>
<p>It’s clearer with two argument functions. Take the functions <span class="math inline">\(addT\)</span> and <span class="math inline">\(addC\)</span><a href="#fn5" class="footnote-ref" id="fnref5"><sup>5</sup></a>, both of which add two numbers together. These are their types:</p>
<p><span class="math display">\[
addT \in (\text{real} \times \text{real} \rightarrow \text{real})\\
addC \in (\text{real} \rightarrow (\text{real} \rightarrow \text{real}))
\]</span></p>
<p>The types tell us that <span class="math inline">\(addT\)</span> takes a <em>pair</em> of real numbers and returns a real number, while <span class="math inline">\(addC\)</span> takes a <em>single</em> real number and returns a <em>function</em> of type <span class="math inline">\((\text{real} \rightarrow \text{real})\)</span>. Therefore, when we write <span class="math inline">\(addC\ x\
y\)</span>, we’re really writing <span class="math inline">\((addC\ x)\ y\)</span>, i.e. we’re applying the function <span class="math inline">\((addC\ x)\)</span> to <span class="math inline">\(y\)</span>. We can omit the brackets because function application <a href="https://en.wikipedia.org/wiki/Associative_property">associates</a> to the left. Similarly the function type <span class="math inline">\((\rightarrow)\)</span> associates to the right, so <span class="math inline">\((A \rightarrow (B \rightarrow C))\)</span> is the same as <span class="math inline">\((A \rightarrow B \rightarrow C)\)</span>.</p>
<p>To really hit the lesson home, convince yourself that the following are all equivalent for a function, <span class="math inline">\(f\)</span>, that takes three arguments</p>
<p><span class="math display">\[
((f\ x)\ y) \ z\\
(f\ x\ y) \ z\\
f\ x\ y \ (z)
\]</span></p>
<p>and understand why <span class="math inline">\(f\ x\ (y\ z)\)</span> is not equivalent to the three above<a href="#fn6" class="footnote-ref" id="fnref6"><sup>6</sup></a>. Here’s a hint: think of what the operator/operand relationships are for every function application, even the symbols within brackets.</p>
<p>For extra credit, draw a tree of the operator/operand (function/argument) parts for each version, including <span class="math inline">\(f\ x\ (y\ z)\)</span>.</p>
<p>This is not just some clever rationalization of multi-argument functions, this is a direct consequence of functions themselves being values. Because they are values just like anything else we can also <em>pass</em> functions to other functions, take the following example:</p>
<p><span class="math display">\[
twice\ f\ x = f\ (f\ x)
\]</span></p>
<p><span class="math inline">\(twice\)</span> is a function that takes two arguments, a function and some other value, and then applies the function ‘twice’ to the value. So if we had a function <span class="math inline">\(add\text{-}one\)</span> which adds 1 to a number and called <span class="math inline">\(twice\
add\text{-}one\ 5\)</span> we would get 7.</p>
<p>Treating functions as ‘first-class’ values has become quite ubiquitous these days, and for good reason! First-class functions allow you separate the <em>form</em> of a computation from the task being accomplished. This is one of the more powerful ideas from functional programming, and as such, Burge will explore it in depth later on.</p>
<h2 id="variables-and-lambdas">Variables and Lambdas</h2>
<p>Up to now we’ve used variables without discussing them, because many of us will have an intuition for what variables mean from other languages or from algebra in school. In this section we’ll be more precise about what a variable means.</p>
<p>Take the following mathematical equation:</p>
<p><span class="math display">\[
f\ x = (5 \times x) + 2
\]</span></p>
<p>This is a function over the variable <span class="math inline">\(x\)</span>. When you plug in different values for <span class="math inline">\(x\)</span> you get different results.</p>
<p>There are two very important properties about variables like the ones in the equation above. The first is that it doesn’t matter what name we give <span class="math inline">\(x\)</span>: <span class="math inline">\(f\
y = 5y +2\)</span> is the <em>exact</em> same equation with the exact same meaning. The second is that in mathematics we don’t actually <em>change</em> the values of a variable: Once we’ve plugged in a value for <span class="math inline">\(x\)</span> that value remains the same.</p>
<p>To better formalise how variables work we’ll use a notation developed by <a href="https://en.wikipedia.org/wiki/Alonzo_Church">Alonzo Church</a>. The following defines the same function using <em>lambda (<span class="math inline">\(\lambda\)</span>) notation</em>:</p>
<p><span class="math display">\[
\lambda x.(5 \times x) + 2
\]</span></p>
<p>We haven’t given the lambda expression a name, which is why in some languages they call lambdas ‘anonymous functions’. There’s nothing stopping us from giving the above a name though</p>
<p><span class="math display">\[
f = \lambda x.(5 \times x) + 2
\]</span></p>
<p>defines the same function again, this time giving it the name <span class="math inline">\(f\)</span>. Here is the crucial point: <span class="math inline">\(f\ x = (5 \times x) + 2\)</span> and <span class="math inline">\(f = \lambda x.(5 \times x) + 2\)</span> are <em>the same function</em>.</p>
<h3 id="taking-lambdas-apart">Taking lambdas apart</h3>
<p>In the same way that function application had two parts, the operator and the operand, lambda expressions also have two parts: the <em>bound variable</em> and the <em>body</em>. Everything between the lambda (<span class="math inline">\(\lambda\)</span>) and the period (<span class="math inline">\(.\)</span>) is the bound variable and everything after the period is the body.</p>
<p>Lambda expressions are functions, which means you can apply values to them (i.e they can be the operator part of a function application). When you apply a value to a lambda expression you substitute that value wherever the bound variable appears in the body and get rid of the bound variable part of the lambda expression, leaving only the body. So <span class="math inline">\((\lambda x. x + x)\ 5\)</span> becomes <span class="math inline">\(5 + 5\)</span>.</p>
<p>We can happily pass lambda expressions to other functions as well (since they are values themselves). Remembering the definition of <span class="math inline">\(twice\)</span> from earlier, the expression</p>
<p><span class="math display">\[
twice\ (\lambda x. x + 1)\ 5
\]</span></p>
<p>is equal to <span class="math inline">\(7\)</span>.</p>
<p>What about multi-argument functions? Well we already learned that multi-argument functions are just single argument functions that return functions, so let’s apply that idea here and define <span class="math inline">\(add\)</span> with lambdas:</p>
<p><span class="math display">\[
add = \lambda x.\lambda y. x + y
\]</span></p>
<p>This actually makes what’s happening when we <em>partially apply</em> a function more clear. If we only pass <span class="math inline">\(add\)</span> one argument what do we get? <span class="math inline">\((\lambda x.\lambda y. x + y)\ 1\)</span> becomes <span class="math inline">\(\lambda y. 1 + y\)</span>, or the function that adds <span class="math inline">\(1\)</span> to its argument.</p>
<h2 id="expressions">Expressions</h2>
<p>So we’ve spent a lot of time going on about function application, lambda expressions, and simple expressions (constants and variables). What do we know now? Well we know all the forms an expression can take. To paraphrase Burge:</p>
<blockquote>
<p>An expression is</p>
<ul>
<li>either simple and is a identifier</li>
<li>or a <em>lambda expression</em> + and has a <em>bound variable</em> which is an identifier + and a <em>body</em> which is an expression</li>
<li>or it is a <em>function application</em> + and has an <em>operator</em> and an <em>operand</em>, both of which are expressions</li>
</ul>
</blockquote>
<p>In the next post we’ll show you the language Burge describes in full, but it’s important to emphasize: Every language construct we will show you can be translated to expressions consisting only of what’s described above. A whole <em>family of languages</em> arises from the three possibilities above. As promised, we have two ways of combining expressions: lambda expressions and function application. The only other piece is that we need a way to refer to things, which is where the identifiers (variables or constants) come in..</p>
<h1 id="conclusion">Conclusion</h1>
<p>The core of Burge’s book, and Functional Programming more generally, is in what is possible with expressions. From this fact stems a lot of what makes Functional Programming such an interesting and exciting field. It affects the way we think about data, the way we think about program structure, and even how we <em>implement</em> our languages. Once equipped with these tools it’s easy to see the shared principles of all functional languages.</p>
<p>It’s very easy to get intimidated by a lot of the language that is thrown around in certain Functional Programming circles these days, but rest assured; understanding expressions and how we can reason about them and manipulate them gets you much further than diving into arcane mathematics ever will.</p>
<p>The rest of the series is going to be a pretty crazy ride, and it all comes back to what we’ve learned here; that expressions come in three mains forms: identifiers, function applications, and lambdas.</p>
<p>Buckle up.</p>
<h1 id="epilogue">Epilogue</h1>
<p><a href="https://twitter.com/josh_triplett">Josh Triplett</a>, <a href="https://twitter.com/kelleyrobinson">Kelley Robinson</a>, <a href="https://twitter.com/heathercmiller">Heather Miller</a>, <a href="https://twitter.com/rob_rix">Rob Rix</a>, and <a href="https://twitter.com/MichaelJBanks">Michael Banks</a> all gave constructive feedback on drafts of this post. Thank them if any of this made sense.</p>
<p>And of course, as promised, we’ve got another Prog Rock hit from the early 70’s, this one’s about a show “you’ve got to see”, a.k.a. how all of the language constructs we are used to can be made up of just expressions ;)</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/IwSTe9uit48" frameborder="0" allowfullscreen>
</iframe>
<p>-JMCT</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>Note that in modern programming language texts and papers <em>range</em> would almost universally be called the <em>codomain</em>. The reasoning is simple: The range of a function is the set of values it <em>actually</em> returns, whereas the codomain is the set of <em>possible</em> return values. So when reasoning about types we’re actually reasoning about the codomain.<a href="#fnref1" class="footnote-back">↩</a></p></li>
<li id="fn2"><p>Here the symbol <span class="math inline">\(\in\)</span> can be pronounced as ‘has the type’. The use of this symbol, which is borrowing from <a href="https://en.wikipedia.org/wiki/Set_theory">Set Theory</a>, has fallen out of favor since the 80’s. The reason for this is that types aren’t <em>really</em> sets, and so using that notation implied something that wasn’t always true. These days you’ll almost universally see the symbol ‘<span class="math inline">\(:\)</span>’ used (e.g. <span class="math inline">\(\ f : A \rightarrow B\)</span>), unless you’re reading something written with Haskell in mind, where it would be <span class="math inline">\(f :: A \rightarrow B\)</span>.<a href="#fnref2" class="footnote-back">↩</a></p></li>
<li id="fn3"><p>The LISP, Racket, and Clojure communities might make this argument, for example.<a href="#fnref3" class="footnote-back">↩</a></p></li>
<li id="fn4"><p>The constants are defined by the system in use and aren’t necessarily equivalent to their pure mathematical counterparts. For example adding two numbers in many languages introduces the possibility of overflow, whereas the ‘true’ <span class="math inline">\(+\)</span> has no such possibility. Or how some languages automatically convert all numeric values to floating point, etc.<a href="#fnref4" class="footnote-back">↩</a></p></li>
<li id="fn5"><p>For those that are curious about the naming, <span class="math inline">\(addT\)</span> is the adding a tuple, and <span class="math inline">\(addC\)</span> is the ‘<a href="https://en.wikipedia.org/wiki/Currying">curried</a>’ addition.<a href="#fnref5" class="footnote-back">↩</a></p></li>
<li id="fn6"><p>The difference is that in <span class="math inline">\(f\ x\ (y\ z)\)</span> only <em>two</em> arguments have been passed to <span class="math inline">\(f\)</span>: <span class="math inline">\(x\)</span> and <span class="math inline">\((y\ z)\)</span>. The expression <span class="math inline">\((y\ z)\)</span> is itself a function application with <span class="math inline">\(y\)</span> as the operator and <span class="math inline">\(z\)</span> as the operand.<a href="#fnref6" class="footnote-back">↩</a></p></li>
</ol>
</section>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>
<entry>
    <title>Introduction</title>
    <link href="http://jmct.cc/intro/index.html" />
    <id>http://jmct.cc/intro/index.html</id>
    <published>2016-12-23T00:00:00Z</published>
    <updated>2016-12-23T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>Introduction</h1>
<h3>Dec 23, 2016</h3>
<h1 id="preface">Preface</h1>
<p>This is the first in a <a href="http://jmct.cc/burge.html">series of posts</a> about what I am calling the “Burge School of Functional Programming”. When I originally <a href="https://twitter.com/josecalderon/status/804154036375187458">tweeted</a> that I was going to do this, I called it the “Burge-Runciman” School, but upon further reflection I think that they are distinct and I was being clouded by the fact that it was <a href="https://www-users.cs.york.ac.uk/colin/">Colin Runciman</a> who taught me about Burge.</p>
<h2 id="motivation">Motivation</h2>
<p>There has been a lot of discussion online in the past few years about what Functional Programming <em>is</em>. This discussion comes in waves and we recently had a high-point when a list claiming to classify levels of Functional Programming was widely distributed.</p>
<p>I, as well as many of my colleagues, found the list a bit disconcerting. It is a dangerous game to try and make such a prescriptive list about a topic; it is a near certainty that any benefits of such a list are far outweighed by the likelihood of any such list alienating those who are looking to get started in Functional Programming.</p>
<p>Independent of the situation I just described, I’ve been dissatisfied with the attitude that Haskell is the ‘truest’ Functional Language, or that it somehow exhibits FP in its ‘purest’ form. Because of this I have wanted to write about some Functional Programming history for a few years now. In particular I want to draw some attention to William H. Burge’s book “Recursive Programming Techniques”, which is a (sometimes forgotten) gem of Functional Programming.</p>
<h2 id="background">Background</h2>
<p>When I was a PhD student at York, I remember reading a paper about parser combinators in Haskell. I went into Colin Runciman’s office and expressed my joy, and in particular I expressed something like “it’s amazing that they were able to come up with something like that!”. This was early days of my PhD when I still wasn’t so great at identifying what’s <em>actually</em> novel in a paper. Colin told me to wait a minute and he went to his bookshelf and grabbed an old book: “Recursive Programming Techniques” by William H. Burge. He suggested I read it.</p>
<p>The book was first published in 1975, three years before Backus’ famous Turing award lecture <a href="http://dl.acm.org/citation.cfm?id=359579">“Can programming be liberated from the von Neumann style?”</a>, which is often seen as a watershed moment in the history of functional programming because it brought so much attention to the field. In my view Burge’s book has aged much better than Backus’ lecture, but that is likely due to other factors.<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a></p>
<h1 id="the-burge-school">The Burge School</h1>
<p>Burge’s book is, in my opinion, one of the best publications on what functional programming is about. This is made even more intriguing when you think about what <em>wasn’t</em> around when this book was first published. In 1975 we did <em>not</em> have:</p>
<ul>
<li>Polymorphic Type Inference</li>
<li>Algebraic Data types</li>
<li>Lazy languages<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a></li>
<li>Lots of Category-theoretic terminology as part of functional programming</li>
</ul>
<p>This is in contrast to how many commentators online talk about functional programming. However, much in the same way that music is not a set of instruments, functional programming is not a set of abstractions that we need to learn and memorize. Functional programming is an <em>approach</em> to solving computational problems.</p>
<p>Many of the abstractions that you do read about are ways to apply this approach to new problems, or problems that were difficult to solve without reaching for more traditional programming methods. But the essence, the core, of what functional programming is about is mostly unchanged.</p>
<p>In the preface to the book Burge writes (emphasis mine):</p>
<blockquote>
<p>The main emphasis [of this book] is placed on those parts of the language, namely expressions, that denote the end results sought from the computer, rather than on the instructions which the machine must follow in order to achieve the results. <em>The main thesis of this book is that, in many cases, this emphasis on expressions as opposed to mechanisms simplifies and improves the task of programming.</em></p>
</blockquote>
<p>The above will be familiar to anyone who has had the good fortune of taking a well designed functional programming course. This is the paradigm shift that sometimes makes functional programming hard to learn for those that are used to other methods of programming. Expressions over mechanisms.</p>
<h2 id="the-book">The Book</h2>
<p>Part of what makes this book so interesting is that it was published as part of a series on programming from IBM. The series was called “The Systems Programming Series” and its charter was</p>
<blockquote>
<p>a long term project to collect, organize, and publish those principles and techniques that would have lasting value throughout the industry.</p>
</blockquote>
<p>IBM was trying to combat the tendency for systems programmers to all continually reinvent the wheel. In other words, this was not a series for the navel gazers in the Ivory Tower, this was for those on the ground programming real systems and solving ‘real world’ problems. Granted, the programming tasks of the day weren’t necessarily the same tasks that a programmer today might be focusing on, but the tools and techniques are more similar than one might think.</p>
<p>The book itself is divided into 5 chapters:</p>
<ol type="1">
<li>Basic Notions and Notations</li>
<li>Program Structure</li>
<li>Data Structures</li>
<li>Parsing</li>
<li>Sorting</li>
</ol>
<p>In the coming weeks we will take a look at each chapter and highlight Burge’s insights. The goal here is to provide a counter to the checklist approach to functional programming material. The core ideas are all here, my hope is that once those are internalized a lot of the modern discourse on Functional Programming can be seen in a new light.</p>
<h2 id="epilogue">Epilogue</h2>
<p>Many of the older functional programmers I know were big Prog Rock fans. I find it fitting that many of those that were early proponents of what was a radical programming methodology were into radical music as well. I don’t know Burge, but I like to imagine that the soundtrack of the 1970’s was in the air as he was writing this book. With that spirit I’m going to link to a Prog Rock hit from the early to mid 1970’s with each post; because, why not?</p>
<p>So, for all of those early functional programmers that were called ‘dreamers’:</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/xkkvBfWAXgI" frameborder="0" allowfullscreen>
</iframe>
<p>-JMCT</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>Backus was trying to do more than just explain functional programming in his lecture, he was trying to turn the tide of programming language research. Because of this some of the technical work in the lecture has not aged super well. For instance in certain parts of the paper Backus emphasises point-free programming using an APL-style syntax. In the decades since the general consensus has moved away from this style.<a href="#fnref1" class="footnote-back">↩</a></p></li>
<li id="fn2"><p>There were call by name languages, and the concept of a delayed computation or a ‘thunk’ was already well known. But I’d argue that the study of laziness <em>as a discipline</em> really only took off in the later 1970’s with the famous papers <a href="http://dl.acm.org/citation.cfm?id=811543">“A Lazy Evaluator”</a> (1976) and <a href="http://www.cs.indiana.edu/cgi-bin/techreports/TRNNN.cgi?trnum=TR44">“CONS should not Evaluate its Arguments”</a> (also 1976). Let me know if I’ve missed something there.<a href="#fnref2" class="footnote-back">↩</a></p></li>
</ol>
</section>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>
<entry>
    <title>Professor Paul Hudak</title>
    <link href="http://jmct.cc/hudak/index.html" />
    <id>http://jmct.cc/hudak/index.html</id>
    <published>2015-04-24T00:00:00Z</published>
    <updated>2015-04-24T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>Professor Paul Hudak</h1>
<h3>Apr 24, 2015</h3>
<p>I just heard, via the <a href="http://www.caringbridge.org/visit/hudak/journal/view/id/5538f5cea589b4216c04438a">Hudak family’s caringbridge journal</a>, that Paul Hudak is in critical condition and unlikely to be with us much longer. My heart goes out to Prof. Hudak’s loved ones in these final moments.</p>
<p>As with many others, Prof. Hudak has had a huge influence on my work and the way I view functional programming. His book “The Haskell School of Expression” (and later “The Haskell School of Music”) introduced artists to functional programming and functional programmers to art. The Haskell School of Music is especially good at being both a programming text and an introduction to computer music (I wish the book had been around when I did my Music Engineering degree).</p>
<p>His influence on programming languages as a discipline is well known. His work was always the right combination of rigorous, interesting, and elegant. He advocated for the use of denotational semantics not only as a tool in specifying the behaviour of programs<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> but as a sanity-check on an idea, arguing that if a language feature could not be elegantly expressed in a denotational semantics then the feature should be reconsidered.</p>
<p>He was also unafraid of expressing unpopular opinions. In a <a href="https://mail.haskell.org/pipermail/haskell-cafe/2007-August/030178.html">Haskell mailing list post</a> he decries the overuse of ‘do’ notation, claiming it obscures, rather than reveals, what’s happening in a program. Having taught hundreds of undergrads Haskell for a compilers course I’ve come to appreciate Hudak’s point. I now start new Haskellers off using explicit <code>(&gt;&gt;=)</code> and lambdas over ‘do’ notation until they understand the underlying structure, then when they graduate to ‘do’ notation there are far fewer students who get thrown when using monads.</p>
<p>On top of Prof. Hudak’s many accomplishments he was known as a very gracious and generous man. I could repeat one of the many stories I’ve been told about him but instead I’ll share the one personal story I have.</p>
<p>I was fortunate enough to meet Prof. Hudak at ICFP last year. I was taking a break during one of the sessions and he was outside relaxing and, in his own words, “dealing with jetlag”. I introducted myself and we had a long chat about functional programming, implicit parallelism, Prof. Colin Runciman (my supervisor), and of course music. One of the interesting things about researching implicit parallelism is that the functional programming community is very split on the idea. Some feel <em>very</em> strongly that it can’t work and is a waste of research effort, while others are excited by the idea and are happy that someone is working on it. When I told Prof. Hudak what I was working on he got excited and was extremely supportive. If he held any doubts about the plausibility of the idea he was gracious enough to put them aside and chat with me about it.</p>
<p>Throughout the rest of the conference he would often come up to me for a quick hello. A few days later he and his PhD student, Dan, invited me to go to the theme park that was near the ICFP venue with them. I turned them down as I ‘had’ to work on a paper<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a>. In those few days of speaking with Prof. Hudak it was clear that he was as gracious and humble as he was brilliant.</p>
<p>My story is not unique, literally every person I have spoken to about Hudak and his work has commented on how nice/generous/humble he was. In a world full of egos and me-firsts, Prof. Hudak embodied what academia <em>should</em> be about: sharing your ideas with others and hearing their ideas, no matter who they are (even star-struck PhD students).</p>
<p>-JMCT</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p><a href="http://www.seas.upenn.edu/~sweirich/types/archive/1988/msg00071.html">Operational vs. Denotational</a><a href="#fnref1" class="footnote-back">↩</a></p></li>
<li id="fn2"><p>Life tip: If one of your heros invites you to a theme park, go. Your research will be there in the morning.<a href="#fnref2" class="footnote-back">↩</a></p></li>
</ol>
</section>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>
<entry>
    <title>Introduction</title>
    <link href="http://jmct.cc/introduction/index.html" />
    <id>http://jmct.cc/introduction/index.html</id>
    <published>2014-11-18T00:00:00Z</published>
    <updated>2014-11-18T00:00:00Z</updated>
    <summary type="html"><![CDATA[<h1>Introduction</h1>
<h3>Nov 18, 2014</h3>
<p>Hello World Wide Web,</p>
<p>I’m a final year PhD student at the University of York, and this is my website.</p>
<p>You’ll probably find posts on <a href="http://www.haskell.org">Haskell</a>, which looks like this:</p>
<pre class="{haskell}"><code>    map :: (a -&gt; b) -&gt; [a] -&gt; [b]
    map f []     = []
    map f (x:xs) = f x : map f xs</code></pre>
<p>Or alternatively, you’ll see posts about making bread, which is my current fascination.</p>
<p>-JMCT</p>
<!--<p class="twitter_follow">If you like this post, you should follow me on
  <a href="http://twitter.com/josecalderon">twitter.</a>
</p>-->
]]></summary>
</entry>

</feed>
