Richard Bird Composes a Functional Pearl
For Richard's 60th Birthday Symposium Banquet
Worcester College, Oxford, 24th March, 2003.
The eminent biologist James Watson is supposed to have said
``Nice is how you are when there's nothing else you have to offer''.
Richard Bird gives the lie to this.
He's very, very clever.
But he's never let his brains go to his head.
So he is also very, very nice. And yet we're all here at this
60th birthday symposium precisely because of what else he has had
Richard and I became colleagues shortly after his 40th birthday.
I don't know if you know the story of what happened at his 40th
Birthday party. It was a lunch at the Savoy Hotel in London.
Now that's a dangerously expensive place for an academic to invite
a crowd to - even a poker-playing academic!
And the after-lunch drinking went on ... and on: into the afternoon,
and past tea-time. Sometime in the early evening somebody lost
his nerve (it might have been the maitre d'hotel) and the bill
arrived. It was an order of magnitude bigger than his credit
limit. He says his friends weren't the least bit annoyed at having
to chuck a few quid into his hat as they left - I guess they'd
helped him out before at Poker games.
Norma sent a discreet reminder of this story along with the
invitation to Richard's 50th birthday party. It was going to be
held at the Manoire au Quat' Saisons - an even more outrageously
expensive establishment than the Savoy... and we were to come
But please let me assure you that tonight's bill has already been
paid in full. There will be no collection as you leave.
(Anyway, my credit is good here)
Now NICE isn't what you'd necessarily expect of someone who has
been a successful Head of Department in this University - Academic
politics are often quite vicious (possibly because the stakes are
I know no aphorisms about having responsibility without power, but
I'm sure one is waiting be coined around the theme of being head of
a small Oxford science department engaged in several joint Degrees.
That's why the Computing Lab Headship is a bit like the last biscuit
on the plate. Everyone keeps saying that they don't want it.
But somebody always takes it.
Richard has had the biscuit for the last 5 years.
And now that he's going to retire as Head of Department before I
come back from my Sabbatical I don't have to be nice to him (even
though I've nothing else to offer).
I had sketched his appraisal, and I was going to read it to him in
front of you, but that would have been ... too Oxford.
But what else can I do for Richard but try to be nice to him?
Actually, he told me what to do:``poke fun'', he said. So, to business!
This is the story of how Richard wrote the very first Functional
Pearl, as if told by Longfellow.1 I hope some of you have heard ``The Song of Hiawatha''
by Longfellow. Richard and I grew up to its rhythms.
(Prologue - in which our hero is introduced)
Richard Bird, a mighty hacker,
He could calculate ten programs.
Do it with such style and swiftness
that the last had left his pen
before the first had reached his journal.
This, by some, had been regarded
As a feat of skill and cunning.
One or two abrasive colleagues
pointed out to him, however,
that it might be much more useful
if he sometimes ran the programs.
(I - in which our hero explains his Methods)
Richard Bird, who had at Cambridge,
studied mathematics closely,
consequently felt entitled
to instruct his fellow men
in any subject whatsoever.
Told them of his pointless programs
Told them they must fight induction
Told them tales of splits and fusions
Introduced banana brackets
Told them a co-product inverse
wasn't quite as complicated
as the algebraists made it.
This, they said, was rather doubtful.
Anyway it didn't matter
What was output by the program.
Either he must get the answer
Much more quickly than at present
Or himself would have to pay for
all the cycles that he'd wasted.
As for understanding Richard
Several of the more outspoken
Made primæval observations
Hurtful of the finer feelings
Of our program calculator.
(II - in which our hero devises a Competition)
Richard Bird, in quite a temper,
Quoted Newton, quoted Leibniz,
Quoted lines of Peter Landin,
Quoted reams of Rodney Burstall,
Quoted quires of Quine and Strachey,
Quoted Hoare and quoted Dijkstra,
(practically in extenso)
Trying to impress upon them
That what actually mattered
Was to get the correct answer.
Several Philistines admitted:
``Such a thing might have its uses.''
``Still,'' they said, ``you would do better
If you wrote it out in Fortran''
So our hero, to convince them
Organized a coding contest
Publicized the exact problem
Said he thought it quite demanding.
Told them derivations must be
laid out in the proper manner
recommended in his textbook
(mainly used for teaching students
sometimes used to throw at Pigeons
when those horrid little creatures
stroll in through our open windows)2
(III - in which the usual suspects arrive)
Sixty Squiggolists attended
each of them with his own arrow
Some of them disguised as morphic
Cata-, ana-, para-, hylo-
Some of them disguised as monads,
State and error - output monads.
All of them said composition
gave them pain in both their gonads.
Next, in marched the Sons of Galois
Bringing with them their connections
Some were burdened with relations
Others struggled with adjunctions
Several tangled in a lattice
(Richard, surely, knows what that is!)
Meertens came with new notation,
(sorry, new interpretation)
let us just use one notation
let us call it Apposition.''
All the acolytes said ``Super!
What we need is bigger page counts
This will make our lives much simpler
Now the first part of each paper
will explain this splendid notion.''
One lone voice, a mere bystander
(not too far from your narrator)
Said it might be hard to read,
Especially if all you wanted
was to tell straightforward stories
of the working of the program.
Though it's in the best tradition
Of your love affair with fusion.
You should call it `complication'!''
(IV - others arrive unexpectedly)
One man came with Glasgow Haskell
said he thought it's use elating
and we shouldn't worry that
he'd implemented var updating.
Frenchmen came upon O'Caml
Left behind their object bagguage
Said ``Today we're calling it
a lazy higher order language.''
Swore they would abjure assignment.
Promised to promote refinement.
Transatlantic came a former colleague with a strange notation.
Lots of little pointy brackets, ampersands and semicolons.
Told us about namespaces and structural types and validation.
Asked if he could use a browser.
Spoke about his love of Pizza.
(Evident his love of Pizza?)
One co-author came with tool
for obfuscating C#-runtime.
Said he'd found a short solution
but was sad because his contract
stopped him showing any code
without six passes of the mangler.
(That was quite a conscience-jangler!)
Next arrived the model-checkers
With their tools (those patience-wreckers)
Spoke of compound hyperspaces
Called the problem parametric
Flashed some terminating traces
Left with grins upon their faces
All the open source types came
with copyleft straight from a bistro.
Said that once solution had been found
they'd put it in their distro.
Red Hat chieftains said they'd put it in their standard installation.
``make config'' (or was it ``config make''?) would deal with compilation.
Marina came and said she thought
the problem wasn't quite as stated
Several hours of videotranscript later
she left, quite deflated.
(V - in which an eponymous research programme is remembered)
One man came with lots of money
Overflowing from his pocket
Said he couldn't solve the problem
now, But thought that infrastructure
Might transcend his limitations.
O.G.S.A., E-Science, Grid!
Spend just one month and make a bid.
Massive grants! Your paths to glory.
(Some recalled the Alvey story!)3
(VI - in which we meet the mores of a modern University)
Other siren voices told him
that he shouldn't bother really
if he couldn't start a spinoff
``Patent it and then get cracking
With angelic sponsors' backing
Raise the cash then start the hacking
Buy yourself all that you're lacking!''
(VII - which the OOP fraternity make their appearance)
All the Object Software people
came with dialects of Java
Some with strongly-typed reflection
Some with abstract window toolkit
But without a single arrow
and without commuting diagram
couldn't really join the contest.
From the land of Abstract Factory
'Cross the Flyweight Bridge of Proxy
Some folk came equipped with patterns:
Model, View, Controller patterns.
Visitor and iterator...
Each with its own motivation.
None with more than two known uses.
Said they understood semantics
but believed them quite sincerely
to be unilluminating.
Said they liked to tell a story
Told us of all kinds of forces
Technical and sociologic.
Drew some very curious pictures.
Told some very arcane stories.
Most of them self-referential.
(Lost their focus something frightful!)
In came Sufrin spouting stuff
that might have been illuminating
if he'd stopped at his first verse...
(VIII - in which our hero solves the problem himself)
Came the morning of the contest.
Several hours of furious coding,
and several whiskies
later and our hacking hero
finished up his derivation
of the answer categoric
to the problem that he'd set them.
Took it to his brand-new Compaq
(bought with his Research Allowance
to replace his tiny Sony)
Typed it in and then compiled it
(Couldn't do it by pen-input!)
After several man-page searches (and some calls to Malcolm Harper)
found the way to start it running.
Happy with his calculation
confident, in expectation,
Richard waited ....
``Yes, indeed, just wait a minute.
Surely it will do some output.''
Richard waited ....
Then, just as he thought of quitting,
came our hero's final answer.
Came as usual, with a pause
between each glyph as it was output.
``It's looking good,'' he started shouting.
Hadn't noticed all the others
leave for home just after breakfast.
(Caml won just as I'd forecast!)
(Epilogue - in which the problem is finally revealed)
Now in a corner of his office
sits alone our hacking hero:
on the purpose of assignment.
Wondering in idle moments
if huge constant factor speedups
might, perhaps, be just what's needed
when the program, if correct,
needs only output ``Hello Richard''!
This document was generated using the
LaTeX2HTML translator Version 2002 (1.62)
Copyright © 1993, 1994, 1995, 1996,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 birdencomium
The translation was initiated by Bernard Sufrin on 2003-05-12
- ... Longfellow.1
- I gratefully acknowledge
the inspiration of ``Hiawatha Designs an Experiment'' by
Maurice Kendall (1959) (The American Statistician 13: 23-24)
- ... windows)2
The Computing Lab at Oxford is plagued by pigeons. They walk into
offices through any window that might be left open. Fr. Saul N. Braindrane
(my alter ego) once found Richard Bird chasing a pigeon round his office with a copy
of the Red and White Functional Programming book in his hand.
- ... story!)3
- The Alvey program was an earlier venture in throwing lots
of money at people who were convinced that knowledge of the
fundamental principles and techniques of Computer Science is
an entirely uneccessary adjunct to enriching the country through
informatics. During this programme Fr. Braindrane met a very senior
tehnical executive of one of Britain's premier informatics companies
who solemnly averred that there was a bright young researcher in
one of his labs who had solved the halting problem. Happily some
of the cash fell on more serious researchers.