The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Well, then, that's just a formula that is evaluated, and you expect to compute the values of a2 and a3 automatically before computing a1.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
It wouldn't make any sense to compute a1 from the old values of a2 and a3.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
And there's no notion of a program counter.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
There's no notion of do this and then do that.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
It wouldn't be sensible to say equals print x plus 3.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
because who knows when or even whether that cell, that formula, will ever be evaluated.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Now, the surprise is that it is possible to do useful things in such a limited language.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
When I learned programming, I learned it by writing machine code, in which the fundamental mode of computation is registers and program counters, and mutation of registers as you go along, and memory.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Computation and mutation seem to be...
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
inextricably interwoven.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
That's how computation gets done.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So it was a surprise to me when I learned that, well, it is possible to do useful things with functional programs.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
I still remember that amazing revelation.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Now, in fact, one way to look at it is this.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Right back in the late 1920s, early 1930s,
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Alan Turing was doing a PhD in Princeton under the supervision of Alonzo Church.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Now, Alan Turing, as we all know, invented the Turing machine, which is fundamentally about mutation.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
It has a little tape, and you can read things from the tape, and then you write back new things onto the tape, and it has an immutable program.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Now, Alonzo Church, at the very same time, was working on something he called the lambda calculus, in which there's no motion of mutation.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
The lambda calculus is like the essence of functional programming.