Lambda the Ultimate Misunderstanding 1
Why was there no functional programming? Because there were no usable implementations and no machines suitable for running such implementations.
And when the past, in which functional programming did not exist, was replaced by a present in which functional programming exists (for now), this present was unevenly distributed.
By choosing a narrower definition of a functional language, we also limited the resources of the resulting research program.
The Edinburgh research program brought together a relatively small number of researchers, so it is quite natural to expect that they used many of the developments of other research programs—developments that, as it happened, were also useful for implementing the functional languages of the Edinburgh program.
And in order to build on a foundation already laid by researchers and implementers, to take advantage of the successes of an earlier and richer programme, there was a suitable candidate: LISP.
John McCarthy
> the FORTRAN idea of writing programs algebraically was attractive.
> McCarthy J. History of LISP [^McCa78]
John McCarthy received a bachelor’s degree in mathematics from the California Institute of Technology in 1948, and in 1949 he accidentally walked into a symposium on cybernetics held at that university. There he heard a talk by von Neumann and became interested in what he would later call “artificial intelligence” [^Stoy79].
McCarthy received his PhD in mathematics from Princeton in 1951 and taught mathematics first at Princeton, then at Stanford, and finally at Dartmouth.
McCarthy was a mathematician, but when, no later than 1955, he began thinking about a programming language for artificial intelligence, he described it not as a mathematical notation like the lambda calculus with extensions. He described it by drawing parallels with natural language. This is a fairly common view of programming languages among their authors—but probably not among the authors of the languages whose history we are writing.
However, in 1955, they didn't know how to make programming languages that looked like natural languages (whatever that meant), nor languages based on mathematical notation. But soon, some ideas appeared.
In 1956 McCarthy organized the famous Dartmouth Summer Research Project on Artificial Intelligence. At this seminar McCarthy encountered the first building block of the language of his dreams—lists. List processing existed in the language of Allen Newell and Herbert A. Simon, IPL (Information Processing Language).
But IPL itself did not make a very good impression on McCarthy; it seemed too low-level. And what language did he consider high-level enough? FORTRAN [^Stoy84].
McCarthy was impressed by the fact that in Fortran one could use expressions like arithmetic operations and nested function calls.
He believed that to get a high-level language for working with lists, one needed to add list-processing functions to Fortran. And already in 1957, McCarthy had the opportunity to add the missing piece—lists—to the cutting-edge high-level Fortran. In that year, N. Rochester, who was then a department head at one of IBM's research centers, decided to realize Marvin Minsky's idea: a program for proving geometric theorems.
McCarthy became a consultant on this project. IPL was originally intended to be used for the implementation, but McCarthy managed to prevent that. Instead of writing their own IPL implementation for the IBM 704 machines, McCarthy advised extending FORTRAN with list-processing facilities. IBM followed this advice, creating what later became FLPL (FORTRAN List Processing Language).
At first, it was difficult for the programmers implementing the extensions—and even for McCarthy himself—to think of list constructors as functions. Functions were things that took and returned numbers, not some sort of constructions in memory. And in general it was hard to see lists as an abstraction behind operations on addresses. As a result, procedures for constructing lists initially did not compose into nested expressions natural for functional languages.
These difficulties were overcome first not by McCarthy, but by programmers Herbert Gelernter and Carl L. Gerberich, who decided that functions could return not only mathematical objects but also “lists,” for which one could perhaps invent strict definitions and laws—but programmers managed without them. McCarthy would later return to those definitions and laws.
This seems to have been the end of these programmers’ contribution to the creation of functional programming. But in that same year, 1957, McCarthy met a programmer whose contribution was still to come.
Steven Russell studied mathematics at Dartmouth, but decided he did not particularly like mathematics. Programming interested him much more, so he abandoned mathematics and began working at the university as a programmer. But in 1957 he wrote nothing for McCarthy other than an assembler manual.
Thanks to contacts established during the Dartmouth seminar, between September 1957 and April 1958 McCarthy worked at MIT on a chess program. He wrote it in FORTRAN and decided that although the expressions available in FORTRAN were good, they were not enough. What FORTRAN lacked was a *conditional* expression.
There were no plans to add such an expression to FORTRAN at that time, but McCarthy was soon presented with the opportunity to work on the creation of a new high-level language from scratch.
At the end of 1957, J. Carr III formed the ACM committee on programming languages. The organizers were looking for participants, and McCarthy became one of them. The committee’s first meeting took place in January 1958, and in April of the same year a subcommittee was formed to work on an international algorithmic language. The members of this subcommittee were J. Backus, J. McCarthy, A. Perlis, and W. Turanski. During April and May of 1958 they wrote “Proposal for a Programming Language.”
McCarthy’s conditional expressions made it into this document—albeit in an unfinished and overcomplicated form. They were not expressions returning values, but producers of labels for `GOTO`. This, of course, made them far less attractive than modern conditionals. Why they ended up this way is understandable: in the international algorithmic language, returning anything nontrivial was not handled particularly well. But more on that later.
Conditional expressions were not McCarthy’s only proposal for the international algorithmic language, but the others were rejected already by the subcommittee.
In June, a meeting of the subcommittee with their European colleagues took place in Zurich. Conditional expressions were rejected there as well.
McCarthy recalls that the conditional expressions were too unusual and that he explained them poorly. This seems like a harbinger of many problems in the history of functional languages—because all their other components are even harder to explain.
In May 1958 McCarthy gave a guest lecture for Minsky’s course. James R. Slagle, who attended McCarthy’s lecture, took notes on how McCarthy described his dream language: "FORTRAN plus variable functions, composite functions (Church lambda), multiple functions, several valued functions of several variables, direct sum of functions, label portion of program with facility to make symbolic substitutions therein...".
Conceptualizing the language as “FORTRAN with lambdas,” rather than “lambda calculus with practical extensions,” again looks more like the reasoning of typical programming language authors than that of the authors of the languages whose history we are writing.
In the summer of 1958 McCarthy worked at IBM on a program for symbolic differentiation. McCarthy did not consider recursion important until he wrote the differentiation program—it was obviously recursive. Working on this program strengthened his conviction that a programming language must have higher-order functions. He came up with the idea of such a function: `maplist`.
That same summer, in early June 1958, McCarthy also tried once more to challenge the decisions of the Zurich meeting. He proposed adding functional variables, lambdas, function composition, arithmetic operations on functions from numbers to numbers, and even standard higher-order functions for differentiation and integration to IAL (International Algorithmic Language). To no avail.
It now became obvious to McCarthy that he would not be able to add all the features needed to turn FORTRAN or IAL into a language for programming artificial intelligence. McCarthy needed to create his own language. And soon he had such an opportunity.