[743] false negative: Y Combinator

Hi,

I'm using Jeffry Schlimmers implementation of the Y-Combinator for
recursive Lambda's, and it causes a false negative with R#:

"Method delegate or event is expected"

The corresponding article can be found here:
http://www.pluralsight.com/blogs/jeffsch/archive/2006/08/18/33631.aspx

The code can be found here:
http://www.pluralsight.com/jeffsch/YCombinator.cs.txt

Also I'm getting a lot of timeouts trying to submit the R# unhandled
exceptions, is there something wrong with the web server?

Best Regards,

Wiebe Tijsma

3 comments
Comment actions Permalink

Hmm additionally R# keeps crashing if I try to use it somewhere in my
code...


Wiebe Tijsma wrote:

Hi,

I'm using Jeffry Schlimmers implementation of the Y-Combinator for
recursive Lambda's, and it causes a false negative with R#:

"Method delegate or event is expected"

The corresponding article can be found here:
http://www.pluralsight.com/blogs/jeffsch/archive/2006/08/18/33631.aspx

The code can be found here:
http://www.pluralsight.com/jeffsch/YCombinator.cs.txt

Also I'm getting a lot of timeouts trying to submit the R# unhandled
exceptions, is there something wrong with the web server?

Best Regards,

Wiebe Tijsma

0
Comment actions Permalink

Looking at the date on that article, I believe that code uses an earlier
revision of the LINQ APIs and will not compile. I seem to recall
experiencing the exact same problem myself with R# when I was looking for a
Y Combinator implementation. Pasting the code into VS would cause it to
crash instantly when R# was running.

I recommend using this implementation of the Y-Combinator instead:

private class Wrap { public readonly Func, T> It; public Wrap(Func, T> it) { It = it; } } public static Func Y(Func, Func> f) { Func>, Func> g = wx => f(wx.It(wx)); return g(new Wrap>(wx => f(y =>]]> wx.It(wx)(y))));
}

It will still produce a warning with R#, but the compiler apparently
produces the same warning, and the code does work.

Cheers,
Mike

"Wiebe Tijsma" <wiebeREMOVE@CAPITALStijsma.com> wrote in message
news:frb5id$p8n$1@is.intellij.net...

Hi,

>

I'm using Jeffry Schlimmers implementation of the Y-Combinator for
recursive Lambda's, and it causes a false negative with R#:

>

"Method delegate or event is expected"

>

The corresponding article can be found here:
http://www.pluralsight.com/blogs/jeffsch/archive/2006/08/18/33631.aspx

>

The code can be found here:
http://www.pluralsight.com/jeffsch/YCombinator.cs.txt

>

Also I'm getting a lot of timeouts trying to submit the R# unhandled
exceptions, is there something wrong with the web server?

>

Best Regards,

>

Wiebe Tijsma


0
Comment actions Permalink

Hi Mike,

Yes it does compile but I didn't actually bother to test if it worked,
just wanted to see if R# could handle it :)

Thanks!

Wiebe Tijsma

Mike Strobel wrote:

Looking at the date on that article, I believe that code uses an earlier
revision of the LINQ APIs and will not compile. I seem to recall
experiencing the exact same problem myself with R# when I was looking
for a Y Combinator implementation. Pasting the code into VS would cause
it to crash instantly when R# was running.

I recommend using this implementation of the Y-Combinator instead:

private class Wrap<T>
{
public readonly Func<Wrap<T>, T> It;
public Wrap(Func<Wrap<T>, T> it) { It = it; }
}

public static Func<T, U> Y<T, U>(Func<Func<T, U>, Func<T, U>> f)
{
Func<Wrap<Func<T, U>>, Func<T, U>> g = wx => f(wx.It(wx));
return g(new Wrap<Func<T, U>>(wx => f(y => wx.It(wx)(y))));
}

It will still produce a warning with R#, but the compiler apparently
produces the same warning, and the code does work.

Cheers,
Mike

"Wiebe Tijsma" <wiebeREMOVE@CAPITALStijsma.com> wrote in message
news:frb5id$p8n$1@is.intellij.net...

>> Hi,
>>
>> I'm using Jeffry Schlimmers implementation of the Y-Combinator for
>> recursive Lambda's, and it causes a false negative with R#:
>>
>> "Method delegate or event is expected"
>>
>> The corresponding article can be found here:
>> http://www.pluralsight.com/blogs/jeffsch/archive/2006/08/18/33631.aspx
>>
>> The code can be found here:
>> http://www.pluralsight.com/jeffsch/YCombinator.cs.txt
>>
>> Also I'm getting a lot of timeouts trying to submit the R# unhandled
>> exceptions, is there something wrong with the web server?
>>
>> Best Regards,
>>
>> Wiebe Tijsma

0

Please sign in to leave a comment.