fork(1) download
  1. open System
  2.  
  3. type Dog =
  4. {
  5. name : string;
  6. breed : string;
  7. say : Dog -> unit;
  8. }
  9. member self.callSay () = self.say self
  10.  
  11. let jim =
  12. {
  13. name = "Jim";
  14. breed = "unknown";
  15. say = fun self -> printfn "%s: woof!" self.name;
  16. }
  17.  
  18. jim.callSay ()
Success #stdin #stdout 0.01s 132672KB
stdin
Standard input is empty
stdout
Jim: woof!