3 ms·
For the case in point, Haskell is much clearer. You can do Pythagorean Triples in one line. Google it if you don't believe me. However, in general, (in my opin
by SomeHacker44 8y ago
For the case in point, Haskell is much clearer. You can do Pythagorean Triples in one line. Google it if you don't believe me.
However, in general, (in my opinion of course) the cognitive load for Haskell is low as a novice, but gets higher and higher as you go down the rabbit hole toward learning, understanding and applying all of its power - which is constantly evolving not unlike C++.
- jandrese 8y agoJust because you can do it in one line doesn't mean that it has low cognitive load. In fact it probably increases the load since you have to think about all of the abstractions that are built into the language instead of reading them off of the screen. The three for loops version lays everything out right in front of your eyes.
- SomeHacker44 8y agoPerhaps you're right. On the other hand, list comprehensions are a core feature of Haskell, which does not have something akin to a "for loop," so it's something a novice would be familiar with as part of learning the core of the language, just as a C++ novice would learn about "for loops." So, I would argue the cognitive load is similar, and both lay everything out right in front of your eyes. Although, Haskell will do it with less syntax (alternatively, read that as "with more syntactic sugar").