Google Blogoscoped

Forum

Idioms in Code (Take a Guess)  (View post)

Tony Ruscoe [PersonRank 10]

Thursday, February 21, 2008
9 years ago6,584 views

Heh. These are brilliant. I've got most of them I think.

I'm not sure about: 4, 8, 10, 11, 22 or 25

I think I can guess at 17 and 21 but without Googling I can't be sure of the exact expressions.

Tony Ruscoe [PersonRank 10]

9 years ago #

Here's an easy one:

if (!fire) {
   smoke = null;
}

Mrrix32 [PersonRank 10]

9 years ago #

Been through them twice still haven't worked out:
7, 8, 10, 19, 21, 22

RC [PersonRank 10]

9 years ago #

10 = fiddling while rome burns
22 = no pain no gain

Varun [PersonRank 3]

9 years ago #

These are lovely

Philipp Lenssen [PersonRank 10]

9 years ago #

Sorry, bug fix at #17: instead of "dark!= dark;" I meant "dark =!dark;" :)

Nathan [PersonRank 0]

9 years ago #

*** SPOILER ALERT ***

// idiom 1
?

// idiom 2
Three's a crowd

// idiom 3
adding insult to injury

// idiom 4
back to the drawing board

// idiom 5
birds of a feather flock together

// idiom 6
blood is thinker than water

// idiom 7
call a spade a spade

// idiom 8
?

// idiom 9
the early bird gets the worm

// idiom 10
fiddling while Rome burns

// idiom 11
garbage in garbage out

// idiom 12
take it with a grain of salt
  
// idiom 13
neither here nor there

// idiom 14
it takes 2 to tango

// idiom 15
an apple a day keeps the doctor away
  
// idiom 16
let sleeping dogs lie

// idiom 17
there's light at the end of the tunnel

// idiom 18
monkey see, monkey do

// idiom 19
it's my way or the highway

// idiom 20
finding a needle in a haystack

// idiom 21
one hand washes the other

// idiom 22
no pain, no gain

// idiom 23
too many cooks spoil the broth

// idiom 24
you can't have your cake and eat it too

// idiom 25
???

// idiom 26
when in Rome...

Mrrix32 [PersonRank 10]

9 years ago #

Well I hadn't heard of 10 or 19 but the other's where obvious once you said them :D

Stephen Tordoff [PersonRank 10]

9 years ago #

// Idiom 1
Good cop, bad cop?

Anatoly [PersonRank 1]

9 years ago #

try (write idiom in code) {
   assert false;
} catch (lameness exception)
{
   assert true;
}

Erik [PersonRank 0]

9 years ago #

Spoiler:

Think 8 is "death by a thousand cuts".

Still not sure about 25.

Douglas Gresham [PersonRank 1]

9 years ago #

8: Death by 1000 cuts?

cw [PersonRank 1]

9 years ago #

25: Stand by me?

Jordan Peacock [PersonRank 0]

9 years ago #

My colleague came up with this one...

var cake=false

The cake is a lie!

Corey [PersonRank 0]

9 years ago #

Hah! that was a funny post!

Philipp Lenssen [PersonRank 10]

9 years ago #

> 8: Death by 1000 cuts?

Yep!

> 25: Stand by me?

Not what I intended, no. But #25 may be a little more fuzzy than the rest and perhaps not make as much sense :)

Corey [PersonRank 0]

9 years ago #

if 'eel' not in hovercfraft:
   break

Stephen [PersonRank 0]

9 years ago #

#25: I can't stand you?

Corey [PersonRank 0]

9 years ago #

#25: stand together?

Philipp Lenssen [PersonRank 10]

9 years ago #

SPOILER
.
.
.
.
Yes that's close Corey, I'll probably have to reveal it as it may be too fuzzy – I was going for "United we stand" (...divided we fall).

kangax [PersonRank 1]

9 years ago #

Aren't there 365 (not 356) days in year?

Philipp Lenssen [PersonRank 10]

9 years ago #

Whoops, fixed, thanks Kangax!

Ianf [PersonRank 10]

9 years ago #

Look-a here, a perlsmith is born! Still, to quote Jonathan Franzen[1], these were "more cutesy than ha-ha funny." Now compile them all to make a perl poem[2].

[1] newyorker.com/archive/2005/05/ ...

[2] unix.org.ua/orelly/perl/prog3/ ...

George R [PersonRank 10]

9 years ago #

Some idioms seem to have a bugs.

Idiom 3 is listed:
   insult += injury ;

idiom 3 revised:
   injury += insult ;

idiom 20 listed:
   hay[ random(0, hay.length – 1)] = 'needle';

idiom 20 revised:
   hay[ random(0, hay.length – 1)] == 'needle' ? found :!found

Is a hay stack a lifo or a a heap?

If kangax's comment is about idiom 15, I do not think the idiom specifies a time period of a year. The constant 356 does seem suspicious.

Philipp Lenssen [PersonRank 10]

9 years ago #

> Idiom 3 is listed:
> insult += injury ;
>
>idiom 3 revised:
> injury += insult ;

Odd, I revised this a couple of minutes after posting, but either I revised in the wrong direction or I didn't save the post :)
Well, fixed now in any case!

/pd [PersonRank 10]

9 years ago #

Ok heres my take on this. still missing a few :(-

heres my answers to each (maybe wrong for some-- open to dispute- final referee is Philipp :)-

1) Good Cop, Bad Cop
2) 2 a company, 3's is a crowd
3) adding insult to injury
4) Back to the drawing board
5) Birds of the feather flock together
6) Blood runs thicker then water
7) A spade is a Spade by any other name
8) Death by a 1000 cuts
9) ??
10) While Rome was burning, Nero was fiddling
11) Garbarge in, Garbarge out
12) With a pinch of salt
13) ?
14) IT takes 2 to tango
15) An apple a day keeps the doctor away
16) Sleeping dogs dont bite
17) Light at the end of the tunnel
18) Aping the way (??)
19) My way or the highway
20) Needle in a Haystack
21) Washing away his hands
22)?
23) Too many cooks spoil the broth
24) you cant have your cake and eat it to
25) ?
26) ?

George R [PersonRank 10]

9 years ago #

The problem with your implementation of idiom 20 is that it is very easy to set a random hay location. It should demonstrate that it is difficult to find a random hay location. Perhaps you are confused because google makes searching through the hay stack easy.

a web version of idiom 20:
   google.com/search?q=needle&as_sitesearch=haystack.com

   google.com/search?q=needle& ...

Philipp Lenssen [PersonRank 10]

9 years ago #

George, idiom 20 was supposed to mean "Needle in a haystack".

George R [PersonRank 10]

9 years ago #

I thought the idiom was "finding a needle in a haystack".

I realize the topic is "Idioms in Code". The example I gave might be for a topic "Web Idioms" or "Idioms in URIs". Because my example had ties to Google it seemed apt for this venue.

Philipp Lenssen [PersonRank 10]

9 years ago #

// song 1
sleep = false;
gogo();

// song 2
wall += brick;

// song 3;
var tiger[i];

// song 4
for (i = 0; i < breath.length; breath++) {
   take(breath);
}

// song 5
var it = now || never;

// song 6
day--;

// song 7
var color = new Color(0,0,0);
canvas.fill(color);

// song 8
mine->childNode->setAttribute(NORMAL_SUGAR * 100);

// song 9
var year = 1980 – 1;

// song 10
compare(null, u);

// song 11
return you ||!you;

// song 12
for (i = 1; i <= 4; i++) {
   print('mmm');
}

// song 13
if (month == 11) {
   setWeather(RAIN);
}

// song 14
person.name = 'jude';
person.greet();

// song 15
var riverHeight = -100;
var mountainHeight = riverHeight * -1;

// song 16
var s1 = 'tutti';
var s2 = s1.replace('tu', 'fru');
print(s1 + ' ' + s2);

// song 17
var you = new Person();
var me = new Person();
checkLove(you, me, today() + 1);

// song 18
speaker.setVolume(0);
speaker.playSound();

// song 19
my.faith = null;

// song 20
var country = new Array('UK', 'Italy', 'USA', 'Spain');
giveBirth(country[2]);

Rohit Srivastwa [PersonRank 10]

9 years ago #

songs

2- Another brick in the wall
5- Its now or never
8- Sweet child of mine
13- November Rain
16- tutti frutti

my.timezone=incompatible
(When I started looking at the thread it was too late for idioms)

me=Bad coder
(When i attempted songs)

Tim Finnegan [PersonRank 1]

9 years ago #

// Other songs :)
// (bug fixes are of course accepted)

// by The Beatles
for(int i = 2;! i.toString().contains('1'); i++)

// by Bob Marley
function song(vibration) {
   return Math.abs(vibration);
}

// by Coldplay
public Part song(Part[] parts)
{
   if(parts == null || parts.count == 0) return null;
   Part result = parts[0];
   foreach(Part part in parts)
   if(part.hardness > result.hardness)
   result = part;
   return result;
}

// by David Bowie
return world.seller();

// by Stevie Wonder
Lover lover = new Lover();
lover.setWorkingHours(4);
return lover;

// by The Police
bottle.contents.add(Console.readLine());

// by The Beatles
public boolean isEnoughMoney(decimal amount, object thing)
{
   if(thing.getType() == typeof(Love)) return false;
   ...
}

// by The Platers
public song(object input)
{
   this = input.clone();
   // I can't believe it but this class is working great!! :P
}

Jake Harbaugh [PersonRank 0]

9 years ago #

1
2 Another Brick in the Wall
3 Eye of the Tiger
4 Every Breath You Take
5 Its Now or Never
6
7 Paint it Black
8 Sweet Child of Mine
9
10 Nothing Compares to You
11 With or Without You
12 Mmmmmmmmmmmm (by the Crash Test Dummies)
13 November Rain
14 Hey Jude
15 Ain't no Mountain High Enough
16 Tutt Fruitti
17
18 Sound of Silence
19 Losing My Religion (???)
20 Born in the USA (???)

Alex Gretlein [PersonRank 1]

9 years ago #

[put at-character here]Tim Finnegan – Yours are the best so far.
Filling in the blanks in Jake's list of the original songs:
1 Wake me up before you go go
6 Yesterday
9 1979
17 Will you still love me tomorrow

Oleg D [PersonRank 0]

9 years ago #

#20 should be probably something like:
Stack<Hay>.find(needle)

otherwise it's more like a hayarray

/pd [PersonRank 10]

9 years ago #

song 9 ??

song 9 should not that read 1970-q ??

/pd [PersonRank 10]

9 years ago #

I meant to say "1970 -1" :)-

George R [PersonRank 10]

9 years ago #

for (daysinaweek=1; daysinaweek<=7;) ++daysinaweek;

Michael Schøler [PersonRank 0]

9 years ago #

ordsprog.sagdejeg.dk – similar concept started the exact same day! LOL – just with code proverbs

Rohit Srivastwa [PersonRank 10]

9 years ago #

[put at-character here]PD
its Smashing pumpkins – 1979

Mrrix32 [PersonRank 10]

9 years ago #

They've all been listed now but I got:
(Songs)2,3,5,7,8.13,14,17

Tony Ruscoe [PersonRank 10]

9 years ago #

Some easy movie ones from me...

// movie 1
while (i < infinity) {
   tomorrow = dies;
   i++;
}

// movie 2
int numerator = 1;
int denominator = 0;
int mission = numerator / denominator;

// movie 3
DateTime later = DateTime.Today.AddDays(28);

Philipp Lenssen [PersonRank 10]

9 years ago #

POTENTIAL SPOILERS
.
.
.
.
.
Jake, you got all things you listed correct except #15 :)

My guesses for Tim's riddle:
- Steve Wonder: Part-Time Lover
- David Bowie: The Man Who Sold the World
- The Beatles: Can't Buy Me Love
- The Platters: Only You (?)

I think I got all of Tony's :)

Mrrix32 [PersonRank 10]

9 years ago #

Song 15.... River Deep – Mountain High?

Rohit Srivastwa [PersonRank 10]

9 years ago #

1. Wham – Wake me up before you gogo
2. Pink floyd – Brick in the wall (The wall)
3. Survivor – Eye of the tiger
4. The Police – Every breath you take
5. Elvis Presley – It’s now or never
6. The Beatles – yesterday
7. Rolling Stones- Paint it black
8. GnR – Sweet child of mine
9. Smashing pumpkins – 1979
10. Sinead O’connor – Nothing compares to you
11. Leonard Cohen – Coming back to you
12. Crash test dummies – Mmm mmm mmm mmm
13. GnR – November Rain
14. The Beatles – Hey Jude (one of my fav songs)
15:
16: Little Richard – Tutti frutti
17: The Shirelles – Will you still love me tomorrow?
18: Simon and Garfunkel – Sounds of silence
19: Seal – lost my faith
20: Bruce Springsteen – Born in the USA?

Disclaimer: Not all answers are mine
Few answers are from crowdsourcing, I added this on my blog

Philipp Lenssen [PersonRank 10]

9 years ago #

> Song 15.... River Deep – Mountain High?

Correct!

Rohit, #11 was supposed to be something else (by U2)... #19 was supposed to be something by REM... :)

George R [PersonRank 10]

9 years ago #

Tony's code seems to have a bug.

It says:

while (i < infinity) {
   tomorrow = dies;
   i++;
}

Shouldn't it be:

while (i < infinity) {
   tomorrow =!dies;
   i++;
}

Tony Ruscoe [PersonRank 10]

9 years ago #

Yep, you're right. Although I guess any code that includes "infinity" is likely to be a bit buggy... :-)

(I had originally put while (i == infinity) but that didn't really make sense.)

K [PersonRank 2]

9 years ago #

while(true)
   if(!tomorrow)
   die();

Lucky [PersonRank 1]

9 years ago #

Tony's Movies:

1. Tomorrow Never Dies
2. Mission Impossible
3. 28 Days Later
  

Glenn Block [PersonRank 0]

9 years ago #

This made my day!

Philipp Lenssen [PersonRank 10]

9 years ago #

// another revision :)

while (i < infinity) {
   i++;
}
tomorrow = dies;

Tim Finnegan [PersonRank 1]

9 years ago #

[put at-character here]Philipp Lenssen: Everything correct except the one by The Platters. For that one, think about the name of the class which implements the method.

Philipp Lenssen [PersonRank 10]

9 years ago #

"The Great Pretender"?

George R [PersonRank 10]

9 years ago #

while (true) {} tomorrow = dead ;

aq [PersonRank 0]

9 years ago #

funny

Tim Finnegan [PersonRank 1]

9 years ago #

[put at-character here]Philipp Lenssen: yep, that's right! :)

This thread is locked as it's old... but you can create a new thread in the forum. 

Forum home

Advertisement

 
Blog  |  Forum     more >> Archive | Feed | Google's blogs | About
Advertisement

 

This site unofficially covers Google™ and more with some rights reserved. Join our forum!