I caught wind of the #CarolsInCode Twitter meme last night. Similar to the #SongsInCode meme, programmers have been merrily expressing famous Christmas carols or songs in code form; either by using the lyrics themselves or expressing the songs structure / message.

Here are my contributions:

you.push(new Christmas(State.MERRY, Size.LITTLE));

My take on GrumpyWookie‘s tweet:

if(weather == "frightful") {
	for(i=0;i< 3;++i) {

This was picked up by simon_watkins who later added some logic:

for each(Angel angel in angels) {
	angel.addEventListener(AudioEvent.SING, hark);

Technically, this would see them ascending into space, but you get the idea!

Vec3 v;
for each(King k in kings) {
	v = star.position - k.position;
	k.position += v;

What Christmas would be complete with out a bit of Wham! (that's rhetorical).

heart = you.hearts.pop();
for each(Person someone in world) {
	if(someone.isSpecial()) {

And if you thought all this Christmas cheer was unbefitting of an Atheist, here's my take on this one:

try {
} catch(TheologyError error) {
	log("God not found");

I'm not sure whether anyone is archiving these, as they did with SongsInCode but for now you can see more here, here and of course here.

Posted on 24 Dec 2010
0 Trackbacks


Carols in Code was posted on December 24th 2010 in the category Notes / Miscellany, Notes, Programming and tagged; .

You can Leave a comment.

Warning: file_get_contents(http://search.twitter.com/search.atom?q=from:soulwire&rpp=1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 410 Gone in /home/soulwire/webapps/soulwire_blog/wp-content/themes/soulwire/functions.php on line 203


One Response to Carols in Code

Leave a Reply to Mathias

  1. Mathias 5 years ago

    It’s not really Christams time anymore i guess, but I just read this and loved it. I have always tried to put some “normal people” sense into my code and actually had a lot of fun with it. But for the past few months I’ve been working with ruby quite a lot and turned out that the really nice ruby syntax works great to come up with some almost correct english sentences like:

    worker.is_available unless worker.is_working?

    even if I don’t like spending too much time on ruby since it’s only useful for backend stuff, which I don’t enjoy as much you still have to really appreciate the syntax.

    Anyways, keep up the good work!

    Reply to this comment