4 ms·
Nope. In the F# version, the '+' is passed in as an argument. That is harder to do in c# without wrapping the operator in a function. it's probably more like
by SideburnsOfDoom 14y ago
Nope. In the F# version, the '+' is passed in as an argument. That is harder to do in c# without wrapping the operator in a function.
it's probably more like
applyBinaryOp(op, a, b) => op(a, b)).
Where op is a wrapper function, in the case of '+' it would be
Func<int, int, int> op = (a, b) => a + b;
- masklinn 14y agohis `applyBinaryOp` was the way it would be called: in F# you'd use applyBinaryOp state (+) in C# you can't use operator sections so you'd have to wrap the operator in a lambda explicitly: applyBinaryOp(state, (a, b) => a + b)
- SideburnsOfDoom 14y agoThat's pretty similar, except you have the "(a, b) => a + b" inline.