|
>> It is in this sense that Prolog to Erlang comparisons should be understood. What I'm saying is that this is the entirely wrong thing to focus on, i.e. syntactic similarities. Prolog is a language of the logic programming paradigm, one of the first ones. Its syntax is that of (a restriction of) the first order predicate calculus. Its programs are First Order Logic theorems. Its interpreter is an automated theorem prover. The motivation for Prolog is the ability to program a computer using the syntax and semantics of First Order Logic, to be able to prove the truth values of statements in a formal language automatically, with a computer. It has nothing to do with Erlang, a functional programming language designed to program telephony switches. Any similarity is superficial: Erlang expressions are not definite clauses; everything in a Prolog program is a definite clause, modulo punctuation. Knowing Erlang will not help you learn Prolog just because the syntax looks similar. You can forget about that right now- that's the misconception I'm trying to correct. Don't encourage people to try to understand Prolog that way because you will only cause them pain. Take the site you link to as an example. It tries to bodge together Prolog with Erlang and Elixir in a "side-by-side reference sheet" that includes rows for "assignment" and "parallel assignment" using =/2. That's the unification predicate! Prolog does not have assignment! Just imagine the suffering of a novice programmer trying to use their knowledge of assignment, in Erlang or any language, to understand the following: ?- X = a, X = b.
false.
That's just setting up programming students to fail, to fail to understand, to fail to learn- and to only succeed in blaming Prolog for being a stupid, painful language that is hard to learn. Of course it's hard to learn! If you go around telling people that they can learn it more easily if they know Erlang!>> Your arguments of grouping/comparing widely dissimilar languages are somewhat disingenuous. No, the point is that they are widely dissimilar and that you won't understand that if you just stop at the syntax. Like the site you link to, where someone clearly made an effort to memorise syntax but completely failed to understand semantics. Semantics shmantics! The attitude I see here is the one that Peter Norvig criticises in "Teach yourself programming in 10 years": try to find a shortcut around the hard stuff so you don't have to use the brain. You don't learn anything that way. |
> Knowing Erlang will not help you learn Prolog just because the syntax looks similar.
That is not what is being suggested. This is your fundamental misconception which permeates the rest of your post. The OP is already studying Prolog and is being advised to look into Erlang too in addition to that. It is not "instead of" but "in addition to" (due to the history of Erlang). Furthermore Erlog allows you to embed Prolog within Erlang giving the OP the best of both worlds.
> you won't understand that if you just stop at the syntax.
Again this is your misconception. That is not what is being suggested. Nobody in their right mind will say "stop at the syntax". But syntax is the gateway into the study of computer languages i.e. you first show the syntax and then explain its semantics. Humans learn new things using analogies/similes/metaphors/etc. Here similar syntax is a great help since it eases the cognitive load while learning new concepts. When the semantic model varies, the dissonance may not be too great and so we can better modify our mental models and understanding.
The website listing the syntax comparisons of various languages is actually pretty useful when looked at with the above viewpoint. Start with your known syntax in a language you know, see how it maps to the same/similar syntax in the language you want to study and then lookup/compare/contrast the semantics of it in both the languages. It is like a cheat-sheet while studying a proper programming language textbook.