3 ms·
>> Although Prolog's original intent was to allow programmers to specify programs in a syntax close to logic, that is not how Prolog works. In fact, a conceptua
by YeGoblynQueenne 8y ago
>> Although Prolog's original intent was to allow programmers to specify programs
in a syntax close to logic, that is not how Prolog works. In fact, a
conceptual understanding of logic is not that useful for understanding Prolog.
Look, I get what the article is saying, but the fact of the matter is that
Prolog has to run on real-world computers and those are not purely logical.
They have working memories and storage, they have processors that take in
instructions one-by-one and so on. It's all nice and well to say that you want
a purely declarative language but, well, we just don't have the hardware for
that sort of thing, at least not yet anyway (and not in the foreseeable
future, given that nobody is really working on that- not anymore, not after
the Fifth Generation Computer programme tanked).
So compromises have to be made. They have to be made at every step of the way.
Compromises like the selection rule for resolvents (this is what makes the
order of clauses in your program matter, when it doesn't in pure logic).
Compromises like having extra-logical predicates, like write/1 and get/1 (the
latter gets the next byte from the current input- what is a "byte" in logical
terms? It isn't). Compromises like the cut, !/0 and even that stupid fail/0,
that give you some control over the interpreter's program flow, which in and
of itself is something completely outside of logic.
But, this is how you get a language that is 90% of the way to the purely
declartive, logic programming ideal. You gotta be, whatsitcalled, pragmatic,
innit.
I also don't agree that teaching the operational semantics of the language
(the four-port model) is the best way to reveal the beauty of the language.
I've been coding in Prolog since around 2008, and I was very comfortable with
that model, but my understanding is still incomplete. I've recently read
"Foundations of Inductive Logic Programming" that has a big intro to logic and
logic programming with endless proofs about subsumption and the soundness of
resolution and so on, and it's like, I was blind in one eye and could only see
half the world. You gotta have a very solid grasp of both the theory and the
practice to code well in Prolog.
... and there's your problem, right there. The investment you have to make to
really master the language is huge and very few people have the resources for
it.
- AlexCoventry 8y ago> The investment you have to make to really master the language is huge What's the payoff?
- YeGoblynQueenne 8y agoThe payoff is that you master a skill that is hard to master, but I suspect you're asking more about what are the rewards in practical terms. For me, the extra effort I put into learning Prolog has actually paid off in career advacement. First, because several potential employers noticed that I listed Prolog in my CV as one of the programming languages I know (a CV is where one is required to brag about what they know, right?) and definitely considered it a factor in their decision to at least interview me, or hire me (I know because they told me). I could of course just list Prolog in my CV without knowing any, but I could have been found out, and I'm a wuss so I'd never do that. Second, because my interest in Prolog led to an interest in AI, because a majority of Prolog textbooks are also (Good, Old-Fashioned) AI textbooks and reading them to learn Prolog led me to learn about AI, and eventually take a Master's course in, well, actually, machine learning and data science, right around the time when it was exploding in popularity. And third, because my interest in Prolog combined with my Master's in machine learning led me to apply for a PhD at one of the highest-rated technology research universities in the UK (and in the world- Imperial College), to study Inductive Logic Programming, which is basically machine-learning Prolog programs from Prolog programs, under the supervision of the guy who, literally, wrote the book. Prolog has taken me places- places I'd never have been without it. Lucrative places, and prestigious places. Anyway you look at it, for me at least, it was a worthy investment in time and effort.
- AlexCoventry 8y agoThanks. Do you know of anyone using modern ML techniques to propose smarter search strategies?
- YeGoblynQueenne 8y agoSorry, I haven't heard of anyone doing something like that. What do you have in mind?
- AlexCoventry 8y agoSomething like reinforcement learning on neural-net parameters, to quickly find solutions to a set of constraints.