I’m ocaml absolute beginner and I’m writing some code for classes and I’ve got a problem with such a line:
datatype logicexpr = Var of string
| Neg of logicexpr
| And of logicexpr * logicexpr
| Or of logicexpr * logicexpr;
let rec distributeLeft(X, And(e,f)) = And(distributeLeft(X, e),distributeLeft(Y, f))
| Or(X, Y);;
Why I get a syntax error here?
The function
distributeLeftdefined by:Can be translated in OCaml to something like:
And so on …