STL comments on Tips and Tricks for Answering Hard Questions - Less Wrong

47 Post author: Wei_Dai 17 January 2010 11:56PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (52)

You are viewing a single comment's thread. Show more comments above.

Comment author: [deleted] 19 January 2010 07:43:54AM *  9 points [-]

Four spaces worked! Thank you.

Effective transformations are uncommon, but when one is possible and you find it, you win. Transformation can't really deal with inherently hard problems, but it can show you that a problem you thought was hard is actually easy if you look at it in an alien way.

I can think of another example, but unfortunately it's even more technical. (Not all hard problems are as easy to state as the Four Color Theorem! But like the BWT, this one directly affects the real world.) C++ programmers have been dealing with a hard problem for decades - the language allows high abstraction to coexist with high performance, but it's a little too fond of copying memory around. This takes time (i.e. decreases performance) for no useful benefit. Recently, scary wizards discovered that the problem of identifying which copies are necessary and which are not can be transformed into the problem of distinguishing lvalues from rvalues (insert animal noises here if you like - this is the technical part). Before this discovery, the language didn't allow programmers to cleanly distinguish between meows and woofs (so knowing this wouldn't have helped ordinary programmers). But compilers have always been able to distinguish between them. It's like Compilers 101, and even C compilers know the difference. Exposing this bit of information to user-programmers in a certain way allows all of those nasty unnecessary copies to be avoided. Someone directly attacking the problem of unnecessary copies would never have invented this in two to the twentieth years.

As a bonus, this solved many hard problems at once - it turns out that once user-programmers can tell meows and woofs apart, they can also solve the "forwarding problem" with "perfect forwarding", making Boost's developers (and me) cry with joy.

To restate, finding an appropriate transformation is a trick that turns a hard problem that you can't directly attack, into an easy problem that you already know how to solve, or can figure out how to solve without very much work. It doesn't solve the problem by itself, but it feels like it does. I would expect most if not all examples to be in mathematics and the hard sciences where abstractions can be cleanly and rigorously transformed, but I would be pleasantly surprised by an example from biology, etc.

(Edit: Avoided unnecessary sentence.)

Comment author: Vladimir_Nesov 19 January 2010 03:45:25PM 1 point [-]

As a former C++ programmer who doesn't keep track of the current events, I'd appreciate a specific link/keyword to the mechanism you were describing.

Comment author: [deleted] 19 January 2010 08:17:47PM *  1 point [-]

This C++0x feature is rvalue references. Wikipedia has an article section about it, although it contains inaccuracies ("The function returning a std::vector<T> temporary need only return a std::vector<T>&&." is wrongity wrong.)

Comment author: Vladimir_Nesov 20 January 2010 12:29:13AM 0 points [-]

Pleased to make an acquaintance of your secret identity. :-) It's a shame you are not on Facebook.

Comment author: [deleted] 20 January 2010 05:25:33AM 1 point [-]

It's a shame you are not on Facebook.

Why? (I'm genuinely curious. I haven't yet figured out how being on Facebook could be a productive use of my free time, which is unfortunately very limited.)

Comment author: Vladimir_Nesov 29 January 2010 07:29:41PM *  2 points [-]

I'm genuinely curious. I haven't yet figured out how being on Facebook could be a productive use of my free time, which is unfortunately very limited.

The basic functionality is simply to keep track of the list of interesting people, ideally with contact info automagically updating. Following the status updates is an extra that supports the sense of being in touch without explicit effort on your part, which can be made efficient if you block enough of the more prolific/uninteresting updates, and/or restrict the connections to people you know reasonably well.

Comment author: Bo102010 19 January 2010 08:00:20AM 0 points [-]

Would upvote again if I could. Please consider this as encouragement to post more.

Comment author: [deleted] 19 January 2010 08:19:37PM 2 points [-]

Thanks; I'll try to write a full post one of these days.