|
|
|
|
|
by rramadass
704 days ago
|
|
Again, the OP is moving from Prolog -> Erlang and not the other way around. You keep repeating "So it's hard for me to see how you're not suggesting that syntax will help you learn Prolog," but that is not OPs path. Erlang evolved out of Prolog and hence some of the syntax/semantics are very similar. To settle this once and for all; in your previous post you gave the example of assignment which actually proves my point that you can easily go from Prolog to Erlang. Why? Because the behaviour is the same in Erlang i.e. there is no assignment but only pattern-matching. You can open a Erlang shell and type in X=a, X=b and it will barf. To show it even more convincingly type in Y=1+2, Y=3 and Y=4 and it will barf only on the last line. Lhs=Rhs are pattern-matched and variables are single assignment. A person with prior exposure to Prolog already knows this and hence can easily map it to Erlang. Only people coming from imperative languages (eg. C) need to adjust their mental model of the "=" operator. When i started with Erlang years ago that was what i had to learn first but thankfully all Erlang books cover it in the introductory chapter itself. Also functions in Erlang are written as a series of clauses which are pattern-matched. I presume you do not have experience with Erlang and so your experience with only Prolog blinds you to the similarities. I highly recommend you get a Erlang book (Joe Armstrong's book is a good one since he uses much of the terminology like "terms", "clauses" etc. from Prolog) and with the help of the cheatsheet just try out the basic syntax in the Erlang shell and see what maps to Prolog. I am quite sure that you will find it convincing. Finally w.r.t. Prolog's computation model being based on Predicate Calculus/First-Order Logic and so the model/semantics are very important is not being denied. I myself came to Predicate Calculus from the "Program Correctness" viewpoint of Floyd/Hoare/Dijkstra and hence an quite aware of its intricacies. But for most programmers without such a background in Set theory/Relations/Logic model building takes time and so syntax is their entry point and understanding happens over a period of time with study and trial-and-error. |
|