TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Donald Knuth used an Erlang-like notation

149 pointsby old_soundover 8 years ago

15 comments

fusiongyroover 8 years ago
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&#x27;s great though. Glad to see some irrational exuberance for it.
评论 #12742204 未加载
评论 #12741505 未加载
评论 #12741442 未加载
评论 #12742290 未加载
pmontraover 8 years ago
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 &lt;&gt; binary and string concatenation operator, not used in this example.<p>The semicolon-period statement separators&#x2F;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 &lt;&gt; 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.
评论 #12742293 未加载
评论 #12741796 未加载
评论 #12745040 未加载
评论 #12741530 未加载
评论 #12742277 未加载
评论 #12741818 未加载
评论 #12741977 未加载
评论 #12742284 未加载
unboxed_typeover 8 years ago
Its interesting how you squeezed &#x27;Erlang language&#x27; 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 :-)
评论 #12741863 未加载
Xophmeisterover 8 years ago
Joe Armstrong&#x27;s comment on this post is gold just for this:<p><pre><code> But as Abraham Lincoln said - &quot;don&#x27;t believe everything you read on the Internet&quot;</code></pre>
peterkellyover 8 years ago
It&#x27;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&#x27;s derived from the way that some mathematical functions are expressed, e.g. i&#x27;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.
评论 #12741550 未加载
sotojuanover 8 years ago
Doesn&#x27;t most of this syntax come from Prolog?
评论 #12741255 未加载
pwdisswordfishover 8 years ago
This article reminds me of the &quot;JavaScript is Scheme&quot; 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&#x27;t make much sense.<p>&gt; 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.
评论 #12741844 未加载
评论 #12744098 未加载
yellowappleover 8 years ago
Are we sure it ain&#x27;t just Prolog?<p>In particular, Erlang&#x27;s syntax is heavily derived from Prolog&#x27;s, so it&#x27;s natural to conclude that Prolog would be the closer relative to Knuth&#x27;s syntax.<p>In reality, though, it&#x27;s probably the other way around; Prolog&#x27;s syntax is in turn more-or-less derived from the conventions in traditional math formulas (especially with the uppercase variables and such).
4adover 8 years ago
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.
评论 #12744065 未加载
评论 #12741892 未加载
rpcope1over 8 years ago
Related: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rRbY3TMUcgQ" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rRbY3TMUcgQ</a>
KeytarHeroover 8 years ago
Uhh, TAOCP predates Erlang by quite a bit. Shouldn&#x27;t the headline be, &quot;Erlang uses a Donald Knuth-like notation&quot;?
评论 #12745209 未加载
GnarfGnarfover 8 years ago
Knuth also created in TeX the notation used by Microsoft&#x27;s Rich Text Format (RTF): {\b bold} etc.
ljbxover 8 years ago
omg, wrong way round. It&#x27;s more math or logic notation.
评论 #12742226 未加载
dangover 8 years ago
This is a good case of where the HN guidelines call for changing a title of an article: &quot;Please use the original title, unless it is misleading or linkbait.&quot; <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;newsguidelines.html" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;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&#x27;re always happy to change it again.
评论 #12742171 未加载
gohrtover 8 years ago
Clickbait title is clickbait.<p>minimal-syntax languages tend to look similar.