Sunday, February 24, 2008

How to translate idioms

Philipp Lenssen at Google Blogoscoped has posted a list of idioms written in code.

If you have a quibble with the format of these remember to
take(salt * .01); (That's one of his coded idioms.)

For the full list go to his page -- and for answers read his readers' comments where issues of syntax and well formedness (appropriately) come up a few times.

// idiom
cop[0].goodInPercent = 100;
cop[1].goodInPercent = 0;

// idiom
a = getThickness('blood');
b = getThickness('water');
assert(a > b);

// idiom
die(1000);
function die(max) {
for (i = 1; i <= max; i++) {
cut();
}
}

// idiom
prey = 'worm';
time = getCurrentTime();
if (time >= 4 && time <= 8) {
bird.catch(prey);
}

// idiom
var here = false;
var there = false;

// idiom
if (i == 2) {
tango();
}

// idiom
function tunnel() {
var dark;
for (i = 0; i < 10; i++) {
dark = true;
}
dark = !dark;
return dark;
}

// idiom
function getGain(pain) {
return pain >= 1;
}

// idiom
if (a != 'cake') a.eat();

// idiom
var location = getLocation();
if (location == 'rome') {
do( location.getCitizen() );
}

2 comments:

  1. I understand about two of those ... I guess at a couple more. It reminds of the Unix version of Santa Claus is Coming to Town.

    And for something completely different, I tag you historically (though you don't have too, of course.

    ReplyDelete
  2. Michael,

    Are you going crazy?

    -Brian

    ReplyDelete

Thanks for reaching out.

You can also contact me at wishydig[at]gmail[d0t]com.