// Increase = n => new Numeral(n)
 public static NumeralWrapper Increase(this NumeralWrapper numeral) => new NumeralWrapper(numeral);
 // Add = a => b => a(Increase)(b)
 public static NumeralWrapper Add(this NumeralWrapper a, NumeralWrapper b) => a.Invoke <NumeralWrapper>(Increase)(b);
 public static NumeralWrapper Fibonacci(this NumeralWrapper numeral) => FixedPointCombinators <NumeralWrapper, NumeralWrapper> .Z(Fibonacci)(numeral);
 public static NumeralWrapper DivideBy(this NumeralWrapper dividend, NumeralWrapper divisor) =>
 FixedPointCombinators <NumeralWrapper, Func <NumeralWrapper, NumeralWrapper> > .Z(DivideBy)(dividend)(divisor);
 public static NumeralWrapper Factorial(this NumeralWrapper numeral) => FixedPointCombinators <NumeralWrapper, NumeralWrapper> .Z(Factorial)(numeral);
 public static string Visualize(this NumeralWrapper numeral) =>
 numeral.Invoke <string>(x => string.Concat(x, "*"))(string.Empty);
 public static uint Unchurch(this NumeralWrapper numeral) => numeral.Invoke <uint>(x => x + 1)(0U);
 public NumeralWrapper(NumeralWrapper predecessor)
 {
     this.predecessor = predecessor;
 }
Example #9
0
 public static NumeralWrapper Factorial(this NumeralWrapper numeral) => YCombinator <NumeralWrapper, NumeralWrapper> .Y(Factorial)(numeral);