There's actually a deep answer to this: looping over just mutable loop variables isn't very powerful. A set of n simple nested loops of k iterations each can only explore k^n possibilities, and n must be static. We can't handle n being a variable.
-
-
I wouldn't say you're alone! but maybe it's a similar sort of plumbing-tracking that you'd face with nested loops? (difficult w/o practice) In this case tho there are no HOFs passed to any other HOFs -- the only HOF here is traverse_. admittedly not obvious up front from syntax
-
I understand loops and I understand “map f”. The problem with higher order functions is that one has to understand the unique argument plumbing of “f g” (or worse) for every higher order f, as if each f were a unique language construct.
- 1 more reply
New conversation -
-
-
I've found it requires a slightly different mindset. It took me some time programming Haskell until I started mentally trusting that—if things compiled—they were wired together correctly. After that, the mental burden of this style of code became *lower* than more explicit code.
-
When I wrote the little snippet—or when I wrote something more complicated like a Prolog interpreter in Haskell—I had a good time exactly *because* I wasn't thinking through what was going on step by step.
- 7 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
