Comment by mattbettinson
7 hours ago
In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought
7 hours ago
In university, Learning prolog was my first encounter with the idea that my IQ may not be as high as I thought
I also found it mindbending.
But some parts, like e.g. the cut operator is something I've copied several times over for various things. A couple of prototype parser generators for example - allowing backtracking, but using a cut to indicate when backtracking is an error can be quite helpful.
"Keep your exclamation points under control. You are allowed no more than two or three per 100,000 words of prose."
Elmore Leonard, on writing. But he might as well have been talking about the cut operator.
At uni I had assignments where we were simply not allowed to use it.
I used to use a cut operator about every 2 to 4 rules. If you are constantly using it as error handling, I would agree you are using it too often. If you are using it to turn sets into scalars or cells, then you are using it correctly. It just makes the code really hard to reason about and maintain.
I thoroughly enjoyed doing all the exercises. It was challenging and hence, fun!
I don't think I ever learned how it can be useful other than feeding the mind.
intro to quantum physics for me (which is only sophomore) I noped out of advanced math/physics at that point, luckily I did learn to code on my own