Re:Generalizing 'jq' and Traversal Systems using optics and ...
by dragonwriter on Wednesday October 07, 2020 @04:11PM
(#24712193)
Functional idioms are often more expressive when you want to do something with a result other than an immediate side effect like printing. Sure, you can use imperative loops to build up a data structure to work with, but functional idioms (or comprehensions, which are generally an imperative-looking wrapper over functional idioms) can be quite concise and expressive for that purpose.
builds a datastructure with the same information yours prints, with no extra boilerplate around building the datastructure.
[ Parent
| on HN ]