Your final example is more-or-less currying, which would also be a useful next step. Also, rather than adding the first argument in the filter() call, you could set this up earlier and make the functions (possibly) even more re-usable:
Indeed currying has made its way out (in a shy way) in this example, I tried to keep the focus on higher-order functions for beginners but you are totally right and those topics are linked together. There is still plenty room for optimizations.
I'm glad that you brought that subject at light so that readers can check that out if they are curious. Unfortunately I would require an entire website if I were to speak about functional programming because this subject is really fun and interesting and full of good ideas and concepts!
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.
Your final example is more-or-less currying, which would also be a useful next step. Also, rather than adding the first argument in the filter() call, you could set this up earlier and make the functions (possibly) even more re-usable:
Hi John and thanks for pointing that out!
Indeed currying has made its way out (in a shy way) in this example, I tried to keep the focus on higher-order functions for beginners but you are totally right and those topics are linked together. There is still plenty room for optimizations.
I'm glad that you brought that subject at light so that readers can check that out if they are curious. Unfortunately I would require an entire website if I were to speak about functional programming because this subject is really fun and interesting and full of good ideas and concepts!