I have a variant type like this:
type score =
InInteger of int
| InFloat of float ;;
Now, given two scores (InInteger(5) and InFloat(5.5)), I want to add, subtract them etc..
How can this be done?
PS - I'm a newbie to OCaml.
Edit::
More specifically:
How does this work?
let n = InInt(2);;
let m = InFloat(3.2);;
let var = InFloat(float n +. m);;
let var = InFloat(float 2 +. 3.2). Regarding(+.)operators onfloat, Jeffrey's comment on my answer is a great explanation. - padocamlREPL (to tell it when to stop!). - Asherah