3 ms·
Is it that much worse than, for instance: kvPairs.reduce((acc, [k,v]) => ({...acc, [k]: v}), {}) (Which obviously has nothing to do with the K-Snippet but i
by lvncelot 5y ago
Is it that much worse than, for instance:
kvPairs.reduce((acc, [k,v]) => ({...acc, [k]: v}), {})
(Which obviously has nothing to do with the K-Snippet but is the first thing that came to my mind that's equally as symbol-heavy)
- wizzwizz4 5y agoYes. I don't know what language that is, but I know what it means: take some key-value pairs, and reduce them with an accumulator, and make a new dictionary with the items from the accumulator, plus another entry mapping a list of the key to a value, starting with {}. Alternatively: mut acc = {} for k, v in kvPairs { acc[[k]] = v; } acc Am I much wrong?
- lvncelot 5y agoHuh, no you're exactly right. (It's javascript, btw)