News for hackers. Stuff that matters.
Re:Can I do FP in my language? by dragonwriter on Saturday August 05, 2017 @05:15PM (#14937946)
> Map and reduce achieve the same result as a for loop so why not use a for loop?

Map and reduce are more clear as to intent for the subset of what a for loop does that they, together, do, and that clarity and limitation has practical advantages for things like parallelization and distribution, which is why MapReduce is an important distributed computation model and ForLoop isn't.

> The functional paradigm fundamentally alters the way the entire program is constructed

Programming paradigms are useful at levels other than “entire program”, which is the reason many modern languages are multiparadigm.

Re:Can I do FP in my language? by jcelerier on Sunday August 06, 2017 @06:25AM (#14940733)
> and that clarity and limitation has practical advantages for things like parallelization and distribution,

and how many of these "parallelized and distributed" map and reduces actually exist out in the wilderness of javascript code ?

Re:Can I do FP in my language? by crimsonalucard on Saturday August 05, 2017 @08:56PM (#14939047)
Your first statement is correct but it's diverging away from my main point.

>Programming paradigms are useful at levels other than “entire program”, which is the reason many modern languages are multiparadigm.

Again I agree with this but your missing the point. To be a multiparadigm language the language needs to provide syntax for switching between muteability and immuteability. The original poster is not talking about this, he is talking about higher order functions which is an entirely different beast.

I would even argue that map filter and reduce aren't even part of any paradigm: functional or imperative as all of these functions can be implemented both using recursion and a for loop... The for loop however is strictly an imperative programming concept.