Record type pattern matching in Ocaml
问题 I'm trying to use pattern matching to write a calculator application. Two major types defined as below: type key = Plus | Minus | Multi | Div | Equals | Digit of int;; type state = { lcd: int; (* last computation done *) lka: key; (* last key actived *) loa: key; (* last operation actived *) vpr: int (* value print on the screen *) };; let print_state s = match s with state (a,_,_,d) -> print_int a; //Here has the compile error print_newline(); print_int d; print_newline();; However, if I