> Monoid
T AddAll<T>(params T[] elements) where T : IMonoid<T> =>
elements switch
{
[] => T.Zero,
[var first, ..var rest] => first + AddAll<T>(rest),
};
It is remarkable how functional C# has become. Not that it wasn't very functional already, what with LINQ and its (much more powerful than Java) generics but the above example really hammers home how much FP has inspired C#, on top of Ocaml's influence on C# generics[0].[0]: https://github.com/ocaml/cwn-data/blob/9ee93e99d984b3f922e25...