Innovenergy_trunk/csharp/Lib/Utils/Combinator.cs

15 lines
305 B
C#
Raw Normal View History

2023-06-13 11:04:07 +00:00
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);
}
}