News for hackers. Stuff that matters.
Re:Can C++ become your new scripting language? by okasaki on Sunday May 17, 2015 @03:32PM (#9561395)
One thing I don't get is why do people prefer functions like accumulate? Why not:

    int sum = 0;
    for(auto&& wc : word_count) sum += wc.second
    return sum;
It's shorter, more general, more familiar, possibly has better performance[[citation needed]], and gives better errors if you mess something up.
Re:Can C++ become your new scripting language? by adrusi on Sunday May 17, 2015 @03:44PM (#9561439)
Its more composable, and because its less general, it more clearly articulates intent and iis easier to scan for bugs.

Or at least it would in an ecosystem where functional programming is embraced, but I don't know how practical it is in practice. Its not composable if you can't expect any other given piece of code to be written in a way conducive to composing with accumulate.

Re:Can C++ become your new scripting language? by Veedrac on Sunday May 17, 2015 @06:59PM (#9562073)
In C++? No idea - I think C++ just has an inferiority complex and wants to look cool.

In other languages, though, it's pretty neat. For example, in Rust one just does

    data.iter().fold(0, |s, e| s + e)
Re:Can C++ become your new scripting language? by lmf4o on Sunday May 17, 2015 @03:35PM (#9561404)
functional programming hype