Archives for: March 2010, 09

09/03/10

Permalink 07:26:39 pm
Categories: General, Programming, .NET

The yield statement cannot be used inside an anonymous method or lambda expression

I thought I was being pretty cool with this code:

IEnumerator<t> System.Collections.Generic.IEnumerable<t>.GetEnumerator( ) {
  Action<unbalancedbinarytree <T>> yielder = null;
  yielder = t => {
    yielder(t.Left);
    if (!t.IsEmpty)
      yield return t.Value;
    yielder(t.Right);
  };
  yielder(this);
}

But as it turns out (and I think I knew before, but had forgotten), C# doesn’t accept this. Not in 3.0 at least, and I think not in 4.0 either. Need to test. Meanwhile – why? Hm…

Permalink 06:06:26 pm
Categories: General

Google's precision is getting worse

… or maybe this is not a recent change at all, I don’t really know.

Long ago I blogged before about the ways Google misunderstands me, and nothing has changed on that particular count. Today I noticed that there’s a new way Google intentionally misinterprets my query. Weird.

So, I was searching for Comparer<t> (try it yourself). Right at the top of the page, Google says this:

Showing results for Icomparer<t>. Search instead for Comparer<t>

Brilliant, eh? I’m starting to think it would be good if Google could have a programmer’s mode or something. Actually, just call it a “accept my queries as they are please, I now what I’m doing” mode. I can’t even guess why it’s doing this thing with Comparer<T> – once I click that link in the prompt, there are several results with that precise string in the page title. The URL changes to this, btw:

<a href="http://www.google.com/search?hl=en&amp;q=Comparer%3CT%3E&amp;nfpr=1">http://www.google.com/search?hl=en&amp;q=Comparer%3CT%3E&amp;nfpr=1</a>

That nfpr parameter seems to make all the difference.

So maybe bing doesn’t have that problem? No, it doesn’t. But then it doesn’t try to suggest anything on that search string either, so I guess somebody could call this a missing feature instead. Oh, and bing doesn’t solve that old problem with “special” characters either – they seem to have established a special case for the term “.NET” (surprise surprise), but searching for something like “.text” or even for help on regexes with “.+?” fails just as miserably as ever.

Enter your email address:

Search

Oliver
MVP logo
March 2010
Sun Mon Tue Wed Thu Fri Sat
 << < Current> >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31