“If we make a bunch of changes to this thing, it looks like this other thing, so they’re actually the same.” ?? I feel like I could prove a great many equivalences using this technique, from the mayans inventing quantum mechanics to who knows what.
Find me a programming language that allows to define a function in many function clauses; that dispatches based on argument pattern matching, that uses semi-colon to separate function clauses, and that marks the end of the function definition with a period.
But the semantics of Prolog are very different, despite looking somewhat similar for historical reasons. First, Prolog does not define functions, but predicates. Superficially, predicates seem to use pattern matching, however Prolog will attempt to prove the bodies of any clause for which the head unifies with the goal. So, e.g.: foo(mulander,Who) will unify Who with tedu and old_sound. Moreover, both something and something else will be called if all the solutions are collected.
Secondly, the role of the semicolon is very different. In Erlang (from what I gather) it separates function clauses or branches of if/case expressions. In Prolog, the semicolon is disjunction: first the left operand is proven, if that fails or more solutions are requested, the right operand is proven, as observed in:
?- write('Hello'); write('World').
Hello
true ;
World
true.
So, yes, Erlang’s heritage is Prolog, hence the oddball syntax. However, the semantics are completely different, and for that reason it’s not an example of a language that does what old_sound says.
I think that the blog post does not have a lot of merit though. As 4ad says, many FP languages have traditionally had a syntax close to mathematics. So, of course FP look similar to some notations used in mathematics.
I know where Erlang syntax comes from. I have talked and listened to Erlang’s creators in person at various conferences. The origins of the language had been the topic of many of those conversations. Besides, almost everyone in the Erlang community knows it comes from Prolog. So citing prolong as a language that uses semicolons and periods like Erlang is no surprise to anyone really.
Find me a programming language that allows to define a function in many function clauses; that dispatches based on argument pattern matching, that uses semi-colon to separate function clauses, and that marks the end of the function definition with a period.
so I did. It matches your criteria. You could change the article s/erlang/prolog/ based on the same reasoning it has now.
The tyranny of online forums, where one has to say exactly what they mean, with no elisions, or be punished to argue with someone about something that was not meant in the beginning.
Good point in general, but I don’t see how that applies here. You assume that we would bash you for rewording what you said earlier, but I think Lobste.rs is perhaps one of the more forgiving places on the Internet to do such a thing.
I think you’ll also be able to find a large number of math papers which use this surface syntax but wouldn’t agree that they’re writing the same language.
Knuth just uses standard mathematical notation. Many languages (mostly functional programming languages) use a syntax similar to mathematical notation. Some of them are much more similar to math than Erlang is.
Interestingly, I found a claim saying Armstrong was copying Knuth in a 2012 joke about an article misreporting it being an Israeli language. It didn’t substantiate it, though, like this one did. Just said it. Someone that’s talked to Armstrong should email him to see if Knuth’s work inspired Erlang in any way.
I’m the author of the blogpost. I’ve met Joe Armstrong in person a couple of times and showed him this part of TAOCP. He just laughed and found it interesting.
“If we make a bunch of changes to this thing, it looks like this other thing, so they’re actually the same.” ?? I feel like I could prove a great many equivalences using this technique, from the mayans inventing quantum mechanics to who knows what.
Find me a programming language that allows to define a function in many function clauses; that dispatches based on argument pattern matching, that uses semi-colon to separate function clauses, and that marks the end of the function definition with a period.
If it’s erlang because it uses periods, doesn’t that mean it’s not erlang because it uses if instead of when?
Sure. Prolog from which most of Erlangs syntax comes from (the first Erlang implementation was written in Prolog)..
But the semantics of Prolog are very different, despite looking somewhat similar for historical reasons. First, Prolog does not define functions, but predicates. Superficially, predicates seem to use pattern matching, however Prolog will attempt to prove the bodies of any clause for which the head unifies with the goal. So, e.g.:
foo(mulander,Who)
will unifyWho
withtedu
andold_sound
. Moreover, bothsomething
andsomething
else will be called if all the solutions are collected.Secondly, the role of the semicolon is very different. In Erlang (from what I gather) it separates function clauses or branches of if/case expressions. In Prolog, the semicolon is disjunction: first the left operand is proven, if that fails or more solutions are requested, the right operand is proven, as observed in:
So, yes, Erlang’s heritage is Prolog, hence the oddball syntax. However, the semantics are completely different, and for that reason it’s not an example of a language that does what old_sound says.
I think that the blog post does not have a lot of merit though. As 4ad says, many FP languages have traditionally had a syntax close to mathematics. So, of course FP look similar to some notations used in mathematics.
I know where Erlang syntax comes from. I have talked and listened to Erlang’s creators in person at various conferences. The origins of the language had been the topic of many of those conversations. Besides, almost everyone in the Erlang community knows it comes from Prolog. So citing prolong as a language that uses semicolons and periods like Erlang is no surprise to anyone really.
You asked:
so I did. It matches your criteria. You could change the article s/erlang/prolog/ based on the same reasoning it has now.
Oh I know what I asked…
The tyranny of online forums, where one has to say exactly what they mean, with no elisions, or be punished to argue with someone about something that was not meant in the beginning.
Congrats.
Good point in general, but I don’t see how that applies here. You assume that we would bash you for rewording what you said earlier, but I think Lobste.rs is perhaps one of the more forgiving places on the Internet to do such a thing.
Perhaps it is, but how should I know when someone comes at me and basically nails a printed quote of what I said to my door.
I think the quotation was being used to clarify rather than accuse.
If you want us to avoid jumping to conclusions about whether you’re correct, don’t jump to conclusions about whether we’re acting in good faith.
I think you’ll also be able to find a large number of math papers which use this surface syntax but wouldn’t agree that they’re writing the same language.
Knuth just uses standard mathematical notation. Many languages (mostly functional programming languages) use a syntax similar to mathematical notation. Some of them are much more similar to math than Erlang is.
This is a non-story with a clickbait title.
Huh, I’m confused… I thought Lisp was the Platonic ideal, no?
He certainly read some Knuth per p287 of this paper:
https://web.archive.org/web/20150323001245/https://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf
Interestingly, I found a claim saying Armstrong was copying Knuth in a 2012 joke about an article misreporting it being an Israeli language. It didn’t substantiate it, though, like this one did. Just said it. Someone that’s talked to Armstrong should email him to see if Knuth’s work inspired Erlang in any way.
I’m the author of the blogpost. I’ve met Joe Armstrong in person a couple of times and showed him this part of TAOCP. He just laughed and found it interesting.
Great read. Also:
found in the comments.
Nitpick: the translation is not equivalent, there is no recursion in Knuth’s algorithm, just a function from one input to one output.
The recursion is implicit, I believe.