I bet that in BBC Basic you can put a FOR-loop in a (not FOR-)loop and nest them as deep as the FOR-loop stack allows. I'd demonstrate it but the best Beeb emulator has wacky keyboard emulation on a Mac and it's too frustrating to write right now. Maybe another day...
The problem with the short Haskell solution here is that it’s a big pointfree expression that requires the reader to reason about interaction of complex library functions. The more a solution can be expressed in simple terms from the problem domain, the more readable it is.
-
-
I dunno, I think that the value of such a concise solution is that you can reason about the parts of the expression independently, then combine them. Reading the BASIC, I can't keep track of what's going on; I had a harder time with the problem statement than this solution!
-
Of course, it comes down to familiarity and habits of thought. If you're habituated to imperative thinking, then the imperative solution looks more obvious. Just recognize that it isn't more obvious to everyone; merely the imperative-language-habituated majority.
- 5 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.
