1. 25
  1.  

  2. 15

    “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.

    1. -3

      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.

      1. 17

        If it’s erlang because it uses periods, doesn’t that mean it’s not erlang because it uses if instead of when?

        1. 8

          Sure. Prolog from which most of Erlangs syntax comes from (the first Erlang implementation was written in Prolog)..

          1. 2

            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.

            foo(mulander,tedu) :- something.
            foo(mulander,old_sound) :- something_else.
            

            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.

            1. -6

              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.

              1. 7

                You asked:

                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.

                1. -4

                  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.

                  1. 6

                    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.

                    1. -1

                      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.

                      1. 4

                        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.

            2. 3

              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.

          2. 19

            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.

            1. 7

              Huh, I’m confused… I thought Lisp was the Platonic ideal, no?

              1. 2

                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.

                1. 7

                  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.

                2. 2

                  Great read. Also:

                  As you know, I’m joking on this article, since as we both know, Erlang copied Scala.

                  found in the comments.

                  1. 1

                    Nitpick: the translation is not equivalent, there is no recursion in Knuth’s algorithm, just a function from one input to one output.

                    1. 2

                      The recursion is implicit, I believe.