15 lines
305 B
C#
15 lines
305 B
C#
|
namespace InnovEnergy.Lib.Utils;
|
||
|
|
||
|
internal delegate Func<T, R> Recursive<T, R>(Recursive<T, R> r);
|
||
|
|
||
|
|
||
|
|
||
|
public static class Combinator
|
||
|
{
|
||
|
public static Func<T, R> Y<T, R>(Func<Func<T, R>, Func<T, R>> f)
|
||
|
{
|
||
|
Func<T, R> Rec(Recursive<T, R> r) => t => f(r(r))(t);
|
||
|
|
||
|
return Rec(Rec);
|
||
|
}
|
||
|
}
|