4 ms·
I think it's perfectly fine in many cases. Like say writing a listToKeyed function. Where I find it fails is when there's a ton of imperative code that's reall
by Waterluvian 7y ago
I think it's perfectly fine in many cases. Like say writing a listToKeyed function.
Where I find it fails is when there's a ton of imperative code that's really hard to understand the premise. The beauty of functional programming is that you can take these stanzas and break them into nicely testable, named functions.
- minitech 7y agoWhat’s a listToKeyed function?
- spoiler 7y agoI think they mean something that turns a list (array) of unique elements into a keyed collection (like a map or an object). So something like: [ {id: 1, name: 'Jane'}, {id: 2, name: 'John'} ] becomes { 1: {id: 1, name: 'Jane'}, 2: {id: 2, name: 'John'} }
- imtringued 7y agoThis is driving me mad. This operation is called groupBy and it is a solved problem. How on earth is HN oblivious to such a fundamental operation?
- minitech 7y agoWho’s HN here? What’s driving you mad? Not really clear what your point is.