Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> it's something used by Erlang Syntax only.

Well... and English syntax. In English, you can specify a list of things by separating each thing with a semicolon and then a sentence is terminated by a period. Example:

> Today I would like you to buy coffee; talk to Sarah about the party if you can, otherwise send her a text; drop off the kids; meet me at soccer practise.

You see how the sentence is terminated with a period, each individual item in the list is separated by a semicolon, and the comma is free to use inside each item to indicate related clauses. I've changed nothing about the structure of that list, except replaced the items with function definitions.

> Today I would like you to define f(m, n, r, 1) as f(m, n, remainder of m divided by n, 2); f(m, n, r, 2) as n if r is 0, otherwise as f (m, n, r, 3); f(m, n, p, 3) as f(n, p, p, 1).

It's the same thing, only we've replaced the mundane everyday tasks with function definitions. Now reformat the thing and we get

    Today I would like you to define

      f(m, n, r, 1) = f(m, n, remainder of m divided by n, 2);
      f(m, n, r, 2) = n              if r is 0, 
                      f (m, n, r, 3) otherwise;
      f(m, n, p, 3) = f(n, p, p, 1).
Sure, Erlang syntax happens to coincide with the syntax of English, and I'm not sure whether this was intentional or not, but it certainly has nothing to do with Knuth.


Really you can use semi-colons on a sentence and then end the sentence with a period? And I thought I had learned something during all my years studying linguistics and grammar.

BTW, newsflash: many languages use semi-colons inside sentences. Spanish for example, which could be argued to be older than English. So did Erlang copy Knuth, or Erlang actually copied El Cid Campeador? I think Erlang comes from El Cantar del Cid.


I just find it more likely that Knuth continued to use English for those definitions, and not that he switched to Spanish, or for that matter Erlang.


For me it's pretty clear he was trying to write the algorithms in Spanish, therefore the semicolons.


Semicolon has two uses in English. First, to separate two related sentences in a way weaker than a period. Second, in place of commas separating items in a list where at least one list item contains commas.


It's a poor mind that can only conceive of two uses for a punctuation mark. Sure, those are the two conventional uses for semicolons, but it's far from all the ways a semicolon can be used. Try combining it with reported speech; consider deploying it in lists which don't contain commas (like this one); use it to jam together sentence fragments in poetry; use it to notate interruption in a screenplay; use it to make your smileys wink ;)...


Conventional uses was all I was speaking to. Clarification of that fact omitted for brevity.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: