I’ve recently posted a very long post here where I discovered I have a fundamental confusion about how OCAML works. The confusion seems to stem that I am only used to Python (imperative languages) so OCAML seems to be a completely different paradigm and Im trying to understand it.
The way I used to think of programming was I have a line and its a statement. It usually returns a value or has side effects (e.g. prints). Thats it. Then it goes forward. Nothing else really. That seems to be a fine rough model of Python. I write code and it executes line by line until its done if it halts. But in OCAML I’ve been emphasized that difference between expressions and statements. I’ve tried googling it but I still don’t know what the difference is or what Im missing. Perhaps answering some of these would be useful
- what is the rigorous precise difference btw statements and expressions in OCAML?
- What part of my thinking about programming do I need to think to understand really what Im doing in OCAML and how it works?
- Is the paradigm of one statement for line insufficient? Why is it insufficient?
Thanks for the help! Hope I can appreciate OCAML better and be an effective OCAML programmer.