I'm working on small program using F# just for the personal training and got some moment, which I can't solve.
I'm describing some interface:
type IСalculations =
abstract member Add : int * int -> int
abstract member Subtract : int * int -> int
abstract member Multiply : int * int -> int
abstract member Divide : int * int -> int
As you can see, the member signature besides the name is the same.
Am I able to do using F# the next (now will be pseudo-code):
let names = [ "Add", "Subtract", "Multiply", "Divide" ];
let ICalculations = new interface;
foreach ( name in names ) {
ICalculations[ name ] : int * int -> int
}
The aim is NOT to repeat for each member the signature int * int -> int
Is it possible?