Features Podcasts Family Video Comics Music Tech Science Books Film & TV Games ✚

Jill

If Hemingway (and Shakespeare, and co) were coders

Cory Doctorow at 5:44 pm Mon, Aug 6, 2012

— FEATURED —

THE LATEST

Guatemala: Archive of documents from Rios Montt genocide trial, overturned 10 days after guilty verdict

THE LATEST

Guatemala: Nation's highest court throws out Ríos Montt genocide trial verdict and prison sentence

Feature

Eurovision 2013: An American in London

Book Review

The Twelve-Fingered Boy - mesmerizing YA horror novel

Book Review

Black Code: how spies, cops and crims are making cyberspace unfit for human habitation

— FOLLOW US —

Boing Boing is on Twitter and Facebook. Subscribe to our RSS feed or daily email.

 

— POLICIES —

Except where indicated, Boing Boing is licensed under a Creative Commons License permitting non-commercial sharing with attribution

 

— FONTS —

Tweet
Kindle

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)

I write books. My latest is a YA science fiction novel called Homeland (it's the sequel to Little Brother). More books: Rapture of the Nerds (a novel, with Charlie Stross); With a Little Help (short stories); and The Great Big Beautiful Tomorrow (novella and nonfic). I speak all over the place and I tweet and tumble, too.

MORE:  Funny • happy mutants • literary theory • Technology • web theory

More at Boing Boing

Eurovision 2013: An American in London

The technology that links taxonomy and Star Trek

  • reglisse

    Ouch!> Theq
    > uo ti
    > ngis don> ein them o
    > stun for tuna
    > te man> ner.

  • http://mordicai.livejournal.com Mordicai

    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.

    • fuzzyfuzzyfungus

      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…

  • https://launchpad.net/~zak-mckracken Zak McKracken

    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.

    • fuzzyfuzzyfungus

      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!

      http://groups.csail.mit.edu/uid/turkit/ 

      (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.)

  • http://www.kmoser.com kmoser

    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.

    • http://twitter.com/JonnyMiskatonic JohnnyMiskatonic

      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.

      • http://www.kmoser.com kmoser

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

  • toyg

    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.

  • Beanolini

    ACT I: in which a ZERO is added for INITIATION

    I’m pretty sure that is actually valid COBOL.

  • Sebastian Liem

    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

    • Chentzilla

      A good one, this.

      Have you got any code left?

      • Sebastian Liem

        Sadly those works seems to be lost to the ravages of time. I did found the unix program yes for a earlier contest.

        http://www.stacken.kth.se/stackhack/20050303/yes.spl

  • Jorpho

    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.