11 Jan

Behold! The eldritch horrors of recursive C programming!

Posted by Bryan White | Monday January 11, 2010 | Whimsy

I owe you a post. Last week was a tough one. Fought a cold. My laptop shit the bed and I’m way behind on writing this article for Screem. So in order to allocate personal resources accordingly, I sacrificed this here blog and I’m sorry for that. Truthfully, I didn’t see much worth talking about last week.

To make up for it, I’ll hook you up with this nugget and a piece of personal information that is probably not terribly valuable to anyone: I write code by day. As much as I’d love to go pro with Cinema Suicide, that’s just not in the cards. Available real estate for professional bloggery in the realm of movies is pretty much taken up and getting into that world means going back in time to a point when only a handful of writers were doing it and there weren’t four or five massive websites out there hogging all the press releases and ad duckets. So to keep a roof over my head, I write code. Web code, but code nonetheless. Cory Doctorow and I are probably the only guys on the internets right now who get a kick out of this short story, but bear with me. All this talk of code is actually going to tie into H.P. Lovecraft in the end.

In computer science, recursion is a function that calls itself to work out an integer or a condition by going over itself again and again and again until the condition is met. It can be tough to wrap your head around and I’m not nearly the kind of programmer that can parse that kind of bullcrap. I was raised on while and for loops (a vastly simplified form of recursion). Real software engineers, however, work out recursion to dizzying degrees of madness that can only be described as “Lovecraftian”. It’s only appropriate, then, that some smart ass software engineer out there with a solid grasp of Lovecraft Country and the C programming language write a short story that reads like The Shadow Over Innsmouth while describing the blasphemy of recursive programming. It’s quite funny.

I had heard tales of the… thing that C.A.R. Hoare had summoned up in ’62– dark hints of choosing one element from an array, and partitioning the rest into lesser and greater sets, and hellishly recursing until the data were twisted into a sorted list– but nothing I could have imagined would be in any way comparable to the daemoniac, blasphemous reality that I saw.

And yet I saw them in a limitless stream– flopping, hopping, croaking, bleating– sorting themselves inhumanly through the spectral moonlight in a grotesque, malignant saraband of fantastic nightmare. Their croaking, baying voices called out in the hideous language of the Old Ones:

void Rlyeh
(int mene[], int wgah, int nagl) {
int Ia, fhtagn;
if (wgah>=nagl) return;
swap (mene,wgah,(wgah+nagl)/2);
fhtagn = wgah;
for (Ia=wgah+1; Ia<=nagl; Ia++)
if (mene[Ia]<mene[wgah])
swap (mene,++fhtagn,Ia);
swap (mene,wgah,fhtagn);
Rlyeh (mene,wgah,fhtagn-1);
Rlyeh (mene,fhtagn+1,nagl);


Read the rest. Maybe you’ll get the joke, maybe not. Either way, you have to agree, that shit reads exactly like Lovecraft, minus any disparaging commentary about jews and black people.

The C Programming Language 4.10 by Brian W Kernighan, Dennis M Ritchie & HP Lovecraft


  1. January 11, 2010 11:38 am


    Disparaging comments on blacks and jews?

    What is it with our society that people have to comment on or apologize about what someone else says in order to save face or sound like they do not tolerate ignorance in the face of the public? Seems like no one can just say something without immediately having to back pedal or make some statement that says “Hey I know I didnt mention anything racist but Ill throw in a comment to make sure the public knows Im not so I look good”

    Lovecraft never seemed racist to me and in all my years Id never heard it mentioned till right now. Any comments he made were because of his time period. My grandparents make comments all the time about black people that the hardcore, right wing, PC folks would say is racist or whatnot when they really arent. My grandparents have black friends, jewish friend and all kinds of different people but when they were raised it was a different world then, they dont mean anything by it, its just how things worked then and Lovecraft predates them by quite a bit.

    Cant say it reminds me of Lovecraft though. It kind of sounds like some college student that fancies himself a linguistics expert and just threw out a bunch of adjetives without really saying anything.

  2. January 11, 2010 11:45 am

    Bryan White

    I just think that shit’s funny. I bring it up every time I write about Lovecraft.

  3. January 11, 2010 3:38 pm


    I am an old pal of Bryan’s and appreciate that he answers his comments. The only one being to serious is Gargus. Bri needs not to save face with anyone and racial/sexist homophobic humor only serves as the brick and morter to my aserbic smile. If you ignorent I’ll laugh at you, if you just like “evil” humor I’ll laugh with you.

  4. January 18, 2010 12:56 am


    You have GOT to check out Charles Stross’ “The Atrocity Archives”, about a mild-mannered IT guy for (roughly) MI6 charged with defending Britain from Lovecraftian terrors.

    Just passing by, but seriously, check it out.

Leave a comment