Knuth is simply defining a piecewise function here in ordinary math notation. Functional programming languages borrow heavily from math, Erlang is a functional language. The resemblance would probably be even more striking with Haskell... which only serves to undermine the message.<p>Erlang's great though. Glad to see some irrational exuberance for it.
To the eye of a developer used to more modern languages that also shows some bad choices in the design of the Erlang syntax. Basically everything that makes the source code less readable than the original: uppercased variables, the minuses that prefix the module and export statements, the wierd =:= operator. I add the also wierd <> binary and string concatenation operator, not used in this example.<p>The semicolon-period statement separators/terminators are in the original and in natural languages, but newer languages proved them to be useless. Probably compilers in the 80s needed some help by the programmer to be fast.<p>Elixir fixed some of the worst offenders, kept others and added something. Examples: the <> is still there but at least we can interpolate strings Ruby like, the useless do at the end of almost every defsomething declarations (the compiler should get it by itself.)<p>But every languages has its wierdnesses, the contest is to have the least of them.
Its interesting how you squeezed 'Erlang language' into some syntax choices. Erlang is about actor model, not about pattern matching. Joe had his inspiration from Prolog - it is a well-known fact from publicly available sources.<p>Anyway, thanks for the article, it sparked some emotions in my brains :-)
Joe Armstrong's comment on this post is gold just for this:<p><pre><code> But as Abraham Lincoln said - "don't believe everything you read on the Internet"</code></pre>
It's called pattern matching, and is present in most functional languages - Haskell is a good example of something which uses this style extensively.<p>In a sense it's derived from the way that some mathematical functions are expressed, e.g. i've seen the fibonacci sequence expressed in this manner a few times.<p>The only thing this excerpt from the book has to do with Erlang is that they both used the same (existing) idea.
This article reminds me of the "JavaScript is Scheme" meme from a while ago. In that people wanted to increase the prestige of their favourite(?) language by shoehorning it into a comparison with something high-status; which comparison, when you think about it, doesn't make much sense.<p>> Interesting curiosity, which proves that the Erlang Syntax is some sort of Platonic Language Ideal that predates all programming languages.<p>Because it supports definition by cases and an if-then-else construct? And because it uses the same punctuation marks that ordinary natural language sentences do? Give me a break.
Are we sure it ain't just Prolog?<p>In particular, Erlang's syntax is heavily derived from Prolog's, so it's natural to conclude that Prolog would be the closer relative to Knuth's syntax.<p>In reality, though, it's probably the other way around; Prolog's syntax is in turn more-or-less derived from the conventions in traditional math formulas (especially with the uppercase variables and such).
Author confuses standard math notation with erlang, missing the fact that other, more pure, functional programming languages even more closely resemble math notation.<p>Nothing to see here.
This is a good case of where the HN guidelines call for changing a title of an article: "Please use the original title, unless it is misleading or linkbait." <a href="https://news.ycombinator.com/newsguidelines.html" rel="nofollow">https://news.ycombinator.com/newsguidelines.html</a><p>A good HN title is accurate, neutral, and close to the language of the original article. If anyone suggests a better title, we're always happy to change it again.