Re:The Haskell Elephant in the Room
by CyberDildonics on Friday July 31, 2020 @09:24AM
(#24008313)
That's not state or branching on a high level of a program. It is in some ways the opposite of what I was talking about and a good representation of the problem.
This looks like it is lazily evaluating parts of a tree, which means that you aren't controlling that state, you are hoping that everything works out when you query it with regards to resources, caching, memory layout, memory freeing, etc.
In a non-trivial program that either will need to optimize memory and cpu usage to scale or be careful about how things are structured to maintain interactivity, something like this is likely to be a big problem if that tree gets big.
I'm assuming you are referring to Haskell? It's a general purpose programming language so of course it handles state, branching, etc...
The above code labels nodes of a multiway tree using a counter. State and branching.