News for hackers. Stuff that matters.
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.

  for (owner <- company.staff)
    for (pet <- staff.pets if pet.type=="cat")
      yield (owner.name, pet.name)
builds a datastructure with the same information yours prints, with no extra boilerplate around building the datastructure.
Re:Generalizing 'jq' and Traversal Systems using optics and ... by spullara on Thursday October 08, 2020 @02:08AM (#24716358)
i would say this is just imperative programming.