4 ms·
Almost any functional programming language has the same power and quality of life in programming, except with the added bonus that things have names. If you co
by johnday 7y ago
Almost any functional programming language has the same power and quality of life in programming, except with the added bonus that things have names.
If you come up with a new looping construct (which you probably won't), just create a type class for it and you're done; any data structure you want now has that construct, if you give it a sensible implementation.
It would be very unusual to write a Haskell program with explicit loops in it. The closest you ever get would be something like `forM_` and even that doesn't really count. I suppose a more direct example would be a recursive function call, but imperative programmers may be surprised at just how few of these actually crop up in production code.
- whateveracct 7y agoAnd even when recursion does show up, the return value tends to "read" better. Like "the sum is the head of the list plus the sum of the tail." Whereas with an imperative loop, I have to either recognize an idiom or manually execute the loop in my brain's VM.