Dost thou know the Seven Immutable Laws of FP?
The leader of the deputation, the least timid of a rather timid bunch, crept up to the great man’s throne – OK, winged armchair – and made his obeisance.
“So tell us! Tell us about the great Functional Reformation of 2017!”
“Yes, do tell us!” chimed his cohort.
Like the sibyl of Delphi, the Great Monad produced his nuggets of wisdom with the aid of artificial stimulants, supplied in the form of ingested hydrocarbons. But whereas the prophetess of Apollo sniffed the hallucinatory gases that oozed into her musty cave, the prophet of functional programming preferred to hold court in the saloon bar of the Leaky Abstraction and Talbot.
The sage sighed, carefully put down his pint, and cleaned the moustache zone above his upper lip with a delicate tongue-tip movement which argued – correctly – long practice.
“What precisely did you want to know?”
After some more nudging and whispering, the spokesman for the gaggle stepped forward.
“Is it really true that the objectives used to…”
“Don’t call them ‘objectives’, son,” the prophet interrupted. “Nothing objective about ’em. If you call them that, you have lost half the battle before you start. Give them their proper name.”
“Yes, sorry. Is it really true that the obj… that the dysfunctionals used to, that they used to…”
“Well? Spit it out.”
“Is it true that they used to write out loops by hand?”
“Yes indeed. Not only did those degenerates use both the while and do forms, they were quite content to run them backwards, break out of them halfway through, whatever they liked. Anything went. Anything. They’d have used goto if they knew what it meant.”
“But… but if the dyzies didn’t use tail recursion in their looping constructs…”
“Oh, you think they didn’t, do you?” The old man snorted with contempt.
“… then how did they control their loops without modifying state?”
“What?” The Great Monad’s voice rose to a shriek. “Of course they modified state. The ‘impure ones’ sanctioned and encouraged the lewd use of naked loop iterator. They mutated their state so often, it’s surprising their memories didn’t melt! Object-oriented programming is the ENEMY of the STATE.”
With the trembling hands of an addict, the old man produced from his pocket a vaping pipe, elaborately nobbled with steam punkish metallic bulges and twists. He drew on it deeply.
“Yes, of course it is. I’m sorry. Um, are you all right?”
The sage had abruptly disappeared inside a huge cloud of vapour, recreating with impressive accuracy the discomfiture of Sir Topham Hatt as represented in plate seven of the Reverend W Awdry’s classic 1948 tale, Thomas and the Unsatisfactory Weld in his Left-hand Side Valve Gear.
“Of course I’m all right,” coughed a voice from within the strawberry-and-prawn-cocktail-scented fug. “Pass me my pint, will you?”
While the interlocutor moved to locate the beer, somebody else opened a window, and normal visibility was swiftly re-established.
“Listen, son,” said the sage, “I don’t want to be rude, but you are one of us, aren’t you? I take it that you are familiar with your category theory? You have read Peyton-Jones’s Book of Martyrs? You do know how to spell ‘Evan Czaplicki’?
“Yes. Yes. Of course I have. Of course I do,” said the youth quickly – a bit too quickly.
“So you won’t mind,” said the Great Monad, “reminding me of the Seven Immutable Laws of FP, will you?”
“Certainly not,” replied the young man calmly, and he recited in the sing-song chanting style they use to teach Scala to the under-fives.
“The Seven Immutable Laws are: Love functions with all thy heart, for there is nothing purer than a function. Always treat functions as first-class objects, for it is truly written that they are worth it. Any side effect is a bad effect. Oh yes. Let no list go uncomprehended in thy sight. Counter-intuitively, laziness beats strictness. Pointfree and composition go together like bacon and lapsed vegetarians.”
“And?” prompted the Great Monad, putting down his glass carefully, and pretending not to hear the outbreak of ill-suppressed sniggers around him.
“And,” said the young man, “you should never hurry a curry.” He put up his hand in triumph at this feat of recollection, revealing an “I ♥ the GOF” tattoo on his upper arm.
“I knew it. I knew it, you disgusting little dyzie!” spluttered the sage, furiously. “I know your kind. You’re the kind that claims that C++ is a functional language, even though its VERY NAME describes the mutation of state. You’re the kind that…”
But his audience had dispersed to the lounge bar, laughing merrily, leaving the last functional programmer in England to finish his beer alone. ®