by NateDad · 11y ago · 0 comments
Either way, a very good reason for not using loops is to make code more readable. If I see a loop I have to run it inside my head to figure out what the intent is, and if there's multiple things going on, that can take time. If I see a 'map' I think "right, this is tranforming every element in this list in this way"; if I see a filter, I think "right, this is removing elements in this list that don't satisfy this property", if I see a groupBy, I think "right, this is grouping elements in this list by this property", etc., etc.
Code isn't only more succinct, it's more human friendly.
Unless you need a do/while loop. Then you're SOL.
Not having generics means we can't properly build these ourselves, and Go doesn't offer list comprehensions, so instead we're forced to for loop.
I used to play with a small plastic hammer when I was in
kindergarden thirty years ago!
I will be very irritated if people laugh at me for trying
to build my new house with this hammer now.
-- Golangers