Question about MAP and Functions, Lambda and non-Lambda

Unsolved

Hi everyone!

I'm not new to google sheets and not new to functional programming, but new to the combination of both. I had a small "problem" to solve today and managed to do so. But I stumbled in a way I didn't expect and honestly still don't understand.

The Problem

I have a Sheet with several Text entries in 4 columns (A-D) and multiple rows. Not every cell contains text. I want to count in the E-column how many cells contain text in this row so that I can sort the fullest rows to the top.

My solution for E2 "=sum( map( A2:D2; lambda( c; int( istext( c ) ) ) ) )"

This works beautifully. And is my first time ever using a Lambda outside of Haskell, so I'm a bit proud. Speaking of Haskell and Lambda Calculus, Lambda(x; f(x)) is redundant and the exact same as f(x). So the obvious and more elegant way to write the very same solution would be:

E2 "=sum( map( A2:D2; int(istext) ) )

But that falls flat on my face. Why? Adding an empty pair of brackets after istext also doesn't help.

Regarding Semicolons: Yes, I have to use them. Commas don't work. Maybe it's because my google sheets is in german.

Thank you in advance for your insights into Google Sheets and/or Lambda Calculus.

Posted Aug 14, 2024, 11:44 AM UTC

111
Loading comments…