I am new to SML, trying to explore SML record and types, specifically how to have function inside a record.
For example, I created below type-
type foo={
var1:int,
f1: int -> int // want to have result of function f1 here
};
Now if I declare record of type 'foo'-
val rec1 = { var1= 10, ....}
I am not getting how to populate the 2nd parameter in the record. f1(10) is giving error.Also, can we declare and define the function inside 'type' like below -
type foo ={
var1:int,
f1 (x)=x+x
};
Please share your opinion.