News for hackers. Stuff that matters.
Re:Ask HN: Do you use programming tricks in real life too? by jkempf on Wednesday September 15, 2010 @06:42PM (#1696125)
I use the Birthday Paradox when I'm searching for matching socks in the morning -- rather than pick a sock and look for one that matches it, I accumulate socks and choose the first pair that match.
Re:Ask HN: Do you use programming tricks in real life too? by mahmud on Wednesday September 15, 2010 @07:58PM (#1696314)
I use Lisp for that same purpose whenever I do my laundry. I cons my socks ahead of time, then serialize the pairs to a drawer. O(1) lookup FTW!
Re:Ask HN: Do you use programming tricks in real life too? by catch404 on Thursday September 16, 2010 @12:51AM (#1696846)
Quite possibly the geekiest hn comment I've read :)
Re:Ask HN: Do you use programming tricks in real life too? by silentbicycle on Wednesday September 15, 2010 @06:58PM (#1696172)
That's an excellent metaphor!

My other favorite programming metaphor is about skiplists: they're like a set of subway lines, with some extra express lines that skip a random (and increasing, for each level) number of stops.

Re:Ask HN: Do you use programming tricks in real life too? by kragen on Thursday September 16, 2010 @01:45PM (#1698504)
I wrote this thing "on the complexity of sock-matching" a few years back: http://www.mail-archive.com/[email protected]/msg0008...

It was more about the problem of matching socks when I put them away, but the same principle applies.

Re:Ask HN: Do you use programming tricks in real life too? by 2arrs2ells on Thursday September 16, 2010 @05:06AM (#1697285)
I use the futon in my bedroom as an L1 cache for frequently worn clothes.
Re:Ask HN: Do you use programming tricks in real life too? by detcader on Friday September 24, 2010 @04:29AM (#1723090)
instead of casting other types, just make everything a string: buy a whole lot of pairs of the same type of sock so you don't have to worry about matching types!