Live data from Hacker News

I don't chain everything in JavaScript anymore

allthingssmitty.com

51–54 of 54 posts

Re: I don't chain everything in JavaScript anymore

#52

I can only say: learn how to use reduce and you never loop twice through a list of items or objects. To me reduce is very easy to reason about and makes it super easy to properly filter, combine, extract values without ending with filters on filters on maps and maps

Doing everything in one reduce step sounds to me like the opposite of "easy to reason about". Reduce is a powerful tool that everyone should know, but you don't always want to wield the most powerful tool, especially if you're after intermediate values like the OP is.

Re: I don't chain everything in JavaScript anymore

#53

Earlier quoted context omitted.

Yeah, nowadays I'm finding more and more of such things and not wanting to read the article further. Sometimes I feel we ignore some good pieces because of LLMification! When I write, I now use LLMs as an alternative to Grammarly and explicitly instruct it to not to rewrite. Sometimes the choice of words are very intentional and LLMs dont "feel"/understand the emotional reason behind that.

> Sometimes I feel we ignore some good pieces because of LLMification! As a heuristic for attention, "does the claimed author care about, understand, or even know what they're writing about?" is not a bad start.

Agree! That made me skim through the article till the end and come back to discussion after AI-detector kicked in.

Re: I don't chain everything in JavaScript anymore

#54
post #46

Folks need to learn how to debug chains. The juice of writing with intermediate variables is not worth the squeeze.

I'll byte: how do you debug chains without intermediate values?

Disclaimer: I wrote a book about pandas that is semi famous because it focuses on chaining. And it has a while chapter on debugging chains.

Debugging: use a debugger, create intermediate variables using .pipe (and side effects), logging, testing, writing your code clearly (use good naming).

Post reply on HN