Oh, well. Yes, you are right. What I wrote I meant it, just as a demonstration exercise, it might be over-engineered. But if it is a method that needs to be used multiple times across a code base, then yes, by all means, wrap it in a function to make it easier to re-use. There are indeed plenty of cases where reduce can help to build functions like smash or scan.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh, well. Yes, you are right. What I wrote I meant it, just as a demonstration exercise, it might be over-engineered. But if it is a method that needs to be used multiple times across a code base, then yes, by all means, wrap it in a function to make it easier to re-use. There are indeed plenty of cases where reduce can help to build functions like smash or scan.