If Hemingway (and Shakespeare, and co) were coders

Fat XXX's "If Hemingway wrote JavaScript" is a great piece of imaginative writing, speculating about the coding styles that various literary titans (Shakespeare, Hemingway, Dickens, Breton and more) would have employed:

function theSeriesOfFIBONACCI(theSize) {

  //a CALCKULATION in two acts.
  //employ'ng the humourous logick of JAVA-SCRIPTE

  //Dramatis Personae   var theResult; //an ARRAY to contain THE NUMBERS
  var theCounter; //a NUMBER, serv'nt to the FOR LOOP

  //ACT I: in which a ZERO is added for INITIATION

  //[ENTER: theResult]

  //Upon the noble list bestow a zero   var theResult = [0];

  //ACT II: a LOOP in which the final TWO NUMBERS are QUEREED and SUMM'D

  //[ENTER: theCounter]

  //Commence at one and venture o'er the numbers
  for (theCounter = 1; theCounter < theSize; theCounter++) {
    //By divination set adjoining members
    theResult[theCounter] = (theResult[theCounter-1]||1) + theResult[Math.max(0, theCounter-2)];   }

  //'Tis done, and here's the answer.
  return theResult;

  //[Exuent] }

If Hemingway wrote JavaScript (via Wired)



  1. If Shakespeare wrote code, we’d still be using it today, & building new languages to support it.  If Hemingway wrote code, it would be taught in school, have the virtue of brevity but be one of those highly over-rated programing languages that people go on about but no one actually uses.  Except that great 10 IF  sale = “baby shoes” 20 THEN ? never used piece of coding, that is admittedly pretty great.

    1. Isn’t Hemingway the one who wrote The Old Man and the C, and cemented the status of big beards and minimalist interfaces in UNIX-user culture? I’m pretty sure I’ve heard of him…

  2. It shows that the author doesn’t like Dickens. I do. However, I don’t know Javascript and shan’t learn it for this purpose.
    Had I written this piece in “Dickens’ Javascript”, it should have depicted Mr Fibbowick collecting the number 0 and 1, then repairing towards his chamber where he would, with much ado, have forced poor little David to add them in an uncomfortable way to make a third, taken it, left the chamber again and proclaimed the result in a fashion such as to make sure every person in hearing range knew about the ingenious discovery he, Mr. Fibbowick, had just made regarding the n+1’th number in the sequence, then waited for whether another number is required, whereupon the whole spectacle would start over.

    Dickens was not an author concerned with deep psychological studies, he was a caricaturist, and he had an agenda. One, I might add, that was well worth pursuing in his time, in his country.

    1. Conveniently, Progress and The Shining Future have made available a system for farming out grindingly menial tasks to the underpaid underclass within the convenient framework of javascript!


      (It lacks all stylistic relation to Dickens; but ‘Mechanical Turk’ is arguably one of the more eloquent middle-finger-in-the-eye-of-the-idea-of-technology-as-human-empowerment systems presently available to customers who aren’t intelligence agencies.)

  3. Yeesh. This is simply “code comments written in the style of [your favorite author of yore].” Surmising why Javascript is more appropriate for any given author is an exercise in futile speculation; it could just as easily be done in any other language, and wouldn’t be any more or less amusing.

    You want something funnier? Try writing examples of code (not comments) whose whose syntax mimics that of a given author. I’ll leave it as an exercise to the reader.

    1. If you read the linked article you will find, perhaps to your great amusement, that there -are- examples of  code (not comments) written in the style of the artists mentioned. As the author explains, the Bard makes a lot of comments.

      1. I did read the article. Apparently I’m not well versed enough in the subtleties of the authors mentioned to find the code samples amusing. If you strip away the comments, they’re basically ordinary code, liberally sprinkled with comments and the occasional string that is related to the “author”.

  4. I am now craving for Javascript snippets by F.S.Fitzgerald. It would give you the wrong results, but with such beauty and grace that you wouldn’t really care.

  5. ACT I: in which a ZERO is added for INITIATION

    I’m pretty sure that is actually valid COBOL.

  6. This reminds me of the Shakespeare programming language [1]. I remember it fondly, we had a drunken programming contest to compute the first five primes. Many great works of literature was composed.

    [1]: http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html

  7. And there it is – the first time I’ve been directed to an .xxx site, and of course it has nothing whatsoever to do with pornography.

Comments are closed.