Lambda Calculus For Excel - Who Ordered That?!
Written by Mike James
Wednesday, 27 January 2021

The lambda calculus is a theoretical construct often used to beat non-mathematically inclined programmers into submission - that and monoids. Now we have Calc Intelligence, a Microsoft Research project to bring lambda to Excel - talk about ivory towers...

Excel is a tool, in the nicest possible way. It's grubby and down-to-earth and we use it to get on with the job of crunching data when there isn't enough structure or repeatability to warrant a more serious approach. Yes, I know that this isn't always the case, but once you have learned Excel you tend to see everything as a spreadsheet, but this is just the same as once you learn about SQL etc...

The Calc Intelligence project is part of Microsoft Research:

"The Calc Intelligence project at Microsoft Research Cambridge has a long-standing partnership with the Excel team to transform spreadsheet formulas into a full-fledged programming language."

As with many academics, they are focused on big idea and the idea that Excel isn't a programming language and hence not Turing complete is one of them. The fact that Excel has a scripting language that makes it more than Turing complete doesn't seem to register. Equally, the fact that Excel formulas have decision-making abilities and the ability to iterate also doesn't seem to weigh much in favor of it being effectively Turing complete. Even a demonstration that it is Turing complete by implementing a Turing machine is dismissed as not being worthy because it has a limited number of states. Show me a real Turing machine that doesn't have a limited number of states and a limited size tape...

OK, so suppose you do want to extend Excel's formulas to produce some sort of Turing completeness in a few cells - how would you do it? Simply add a programming language to the functions that permits loops, and perhaps a way to define new functions although this isn't strictly necessary. What Microsoft Research has actually done is to implement a form of lambda calculus, which is generally agreed to be a mathematical notation used in computer science to prove things that are often obvious in the first place.

Most programmers don't know lambda calculus and don't need to know it. The only encounter they probably have with it is its name being used for lambda functions. Calling a standalone one-line function a lambda function is about as silly as calling JavaScript  Java-Script. The association is tenuous in the extreme in both cases.

The idea of using lambda calculus in Excel to extend what you can do with formulas will be a mystery to many programmers, but the researchers write:

"Moreover, LAMBDA is the true lambda that we know and love: a lambda can be an argument to another lambda or its result; you can define the Church numerals; lambdas can return lambdas, so you can do currying; you can define a fixed-point combinator using LAMBDA and hence write recursive functions; and so on."

All I can say is that if this makes any sense to you then you really should be using Haskill, not Excel.

Lambda's are hard to appreciate, but fear not:

"Moreover, even if it takes greater skill and knowledge to author a lambda, it takes no extra skill to call it. LAMBDA allows skilled authors to extend Excel with application-domain-specific functions that appear seamlessly part of Excel to their colleagues, who simply call them."

So if you're not bright enough to understand lambda calculus, you can just use it like a dumb ape... We all know where that ends up. Spreadsheets are dangerous enough without making them super dangerous by way of academic obfuscation.

In short, this is not a practical solution and it is to a problem that probably doesn't even exist.

It would make more sense to put Lisp into a spreadsheet cell and this is a silly idea as well!

What we have here is an academic curiosity - a desk ornament or toy. It might amuse some people clever enough to recognize a lambda when they see it, but down-earth-spreadsheeting it isn't.

•  Mike James is the author of The Programmerâ€™s Guide To Theory which sets out to present the fundamental ideas of computer science, including Turing completeness and lambda calculus, in an informal and yet informative way.

LAMBDA: The ultimate Excel worksheet function

#### Related Articles

Lambda Calculus

Microsoft Adds Custom Data Types To Excel

Excel Adds New Data Types

Is Excel To Blame For Our Economic Pain?

Companies That Use Spreadsheets Survive

 Android 15 Developer Preview Updated25/03/2024Google has released Android 15 Developer Preview 2 with changes including better handling of automatic language switching and updates for OpenJDK 17. + Full Story Conference Times Ahead29/03/2024Following a well-established pattern both Google's and Microsoft's Developer Conferences will take place in May while Apple follows on in June. Here are the dates plus what to expect. + Full Story More News