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:
It's shorter, more general, more familiar, possibly has better performance[[citation needed]], and gives better errors if you mess something up.
[ Parent
| on HN ]
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)