Monthly Archives: February 2022

Poor Man’s Lambda

Excel now has LAMBDA. If you define a name that refers to the formula =LAMBDA(args, ..., body) then you can use the name just like a built-in function by supplying its args,...

I’ve implemented a poor man’s lambda using only a few lines of code. It has the unusual, but hopefully apt, name \ which turns out to be a valid Excel function name. To create the ToCelsius function in the video enter =\("(5/9)*(_0 - 32)") in a cell to get a handle to the lambda. If you name the cell containing the handle ToCelsius then you can call it with \(ToCelsius, 451). The body uses the convention that the i-th argument is written _i. Creating and calling a lambda use the same function name \. If the first argument is a string and there are no other arguments it creates a lambda. If the first argument is a handle to a lambda then it uses that to call the function on the remaining arguments.

This is not production quality code. I don’t have Satya’s wallet to hire Haskell heavy hitters. If you figure out a way to break it let me know. If there is functionality (sic) that LAMBDA has that \ doesn’t, don’t be shy about pointing that out. It is not clear to me yet how many users will find either the rich man or poor man’s lambda useful.