I like functional programming concepts but I think that much of the time the code becomes larger and messier.
For example if you have code like that (JS):
let str = user.status == 'is_admin' ? 'active user' : 'user inactive';
It's very hard to do this in FP style with less or similar code length.
For example in FP pseudo library:
let str = F.if(F.propEq('status', 'is_admin'), 'active user', 'user inactive'))(user)
But you see its ~10 chars more than the imperative style.
Do you have suggestions if it can be shortened?
The code is just sample but I noticed in many cases the FP style gets longer than the imperative code.
?:operator. Also, the goal of FP isn't to be shorter.?:operator is—let me count—*two* characters. It'll be very hard indeed to be any more concise then this, when a function invocation alone is already at least three characters.mapandreducecame in ES5. ES5 was a pretty big step, much bigger than from ES5 til ES6 IMO.