I do agree that C++ is not a good language for beginners. I think a language similar to Python but with static type checking will be a good one.
I do agree that C++ is not a good language for beginners. I think a language similar to Python but with static type checking will be a good one.
You say "clean all those dishes", not "let x=0, then while x<N, clean the x-th dish from the top, then let x = x+1"
Ask someone without a scientific background to solve (a * b) + (c * d) with a (physical, non-software) calculator. The "correct" answer is to do something like: a * b, M+, c * d +, MR. What they will do is: solve a+b, write down the result, then do the rest. They don't think of a calculator as something stateful.
But if we are using calculators, then depending on the make and model, you might do a b * c d * +, Which achieves the goal your second paragraph is aiming for: getting rid of (or at least abstracting away) any explicit use of incidental or intermediate state (which takes the form of memory operations in conventional calculators.)
RPN calculators (and programming languages), however, never became popular, and I strongly suspect that is because their expressions are often objectively harder for humans to comprehend, no matter how elegant RPN seems.
I agree on RPN, that was the point I was trying to make. RPN is more powerful, but is stateful and uses a rather complicated and unintuitive form of state (a stack). In my experience it's not true that people find it more intuitive to work with arbitrary mutable state of the kind imperative programming languages traditionally have.
Also, machines deal with data - which is encoded information about the world.
So when we say that a thing 'changes' in the world, what we're actually saying is that at time T, something happens to the world and from then on, the data we read back is different.
'Something happened' is new information which is added on top of the state of the world at time T-1.
Eg. the user e-mail does not 'change' to be come X, but rather, it used to be Y, then the user changed it to X on 1st of May.
So we can generalize that the world is a function `f` of some state combined with extra data of what happened at time T, giving us the state at T.
Apparently it is not, because otherwise it wouldn't have taken so long for the concept to spread, and folks like the romans would have used 0 from the beginning.
But just because something is not natural does not mean it is not more productive than the alternative solutions, given that one spends the time to learn it.
So, maybe mutating state is natural - but I would object the claim that this means it is more productive.
Monad is like highly effective and complicate patch to handle thing who couldn't be pure function. i don't like Haskell because of that is not natural force that much the langues for me(opinion), but is like try to tech Rust as first langues you don't have the grasp in the limitations to understand why ownership matters, and why all the langues need to be kind a weird, is still weird but you understand the advantage and grasp at least the syntax and basic patters make it more pleasure to learn it.
Haskell is hard for programmers, because it forces them to truly think. Haskell grows on you when you get to know how it evaluates and forces you to separate concerns structurally. For that reason, it's said to be a language that teaches you how to program better.
C was already taken out of curriculum (students were expected to learn it from the C++ learnings), and we made use of our own collection classes with bounds checking.
The secret was teaching the language on its own, and not as C with extras.