4 ms·
As in Prolog ',' and ';' are separators: ',' behaves like an and, first do then and then do this (as in Prolog); while ';' is an or, do this clause or do this c
by rvirding 14y ago
As in Prolog ',' and ';' are separators: ',' behaves like an and, first do then and then do this (as in Prolog); while ';' is an or, do this clause or do this clause (again as in Prolog). '.' ends something, in this case a function definition. Erlang's functions clauses are not the same as Prolog's clauses which explains the difference.
It is very simple really, think of sentences in English and it all becomes trivially simple.How many sentences end in a ';'?. And you almost never need to explicitly specify blocks.
Here http://ferd.ca/on-erlang-s-syntax.html http://ferd.ca/on-erlang-s-syntax.html are some alternate ways of looking at it.
- silentbicycle 14y agoIndeed. It makes sense to me. Are my intuitions about the origins of ;s separating top-level clauses accurate? (Hello, Robert! :) )
- rvirding 14y agoSort of. The syntax evolved at the same time we were moving from Prolog onto our own implementation, which forced us to write our own parser and not rely on the original Prolog one. The biggest syntax change came around 1991, since then it has been mainly smaller additions and adjustments.