Friday, September 02, 2022

MS Office 365 + Scheme (LISP) ?

The Excellent Schemer @CodeMag

AccelerateTM for Microsoft 365 is a new, commercially available Microsoft Office add-in that deeply integrates the Visual Scheme for ApplicationsTM (VSATM) programming language into the popular back-office automation suite, for versions 2016 and later. VSA intends to serve as the “third musketeer,” alongside Visual Basic for Applications (VBA) and the popular formula expression language of Excel, but with a twist: Under the hood of this uniquely powerful language is the full reach and power of the .NET Framework.

At first glance, Scheme might seem an odd choice of a language to tag team with VBA and Excel's formula expression language. On closer inspection, and especially considering Microsoft's new, explicitly “functional programming” direction with Excel's formula expression language, Scheme seems the inevitable choice.

One thing that surprises developers who haven't yet had a chance to explore a proper Lisp is how similar the new LET/LAMBDA functions in Excel look, or at least feel, like Lisp/Scheme. Here is an example of an Excel LAMBDA/LET function:

=LAMBDA(X,Y,LET(XS,X*X,YS,Y*Y,SQRT(XS+YS)))

Now here's the same thing in Scheme:

(lambda (x y) (let ((xs (* x x)) (ys (* y y))) (sqrt (+ xs ys))))

No comments: