If you ask how to rewrite powerFunctionGenarator
in C #, you can do it quite simply:
Func<double, double> powerFunctionGenarator(double baseNumber) { return exponent => Math.Pow(baseNumber, exponent); }
You cannot put this method declaration, like this, inside another method in C #. But if you want to do this, you can use lambda in lambda, as sblom suggested:
Func<double, Func<double, double>> powerFunctionGenerator = baseNumber => exponent => Math.Pow(baseNumber, exponent);
Which is equivalent to the following code in F #:
let powerFunctionGenarator = fun baseNumber -> (fun exponent -> baseNumber ** exponent)
svick
source share