I'm a very novice OCaml programmer so please forgive me if this is a stupid/obvious question. There's a lot to absorb and I may have missed this in the documentation.
I have a base of code that's starting to look like this:
let update_x p x =
add_delta p;
p.x <- x;
refresh p
let update_y p y =
add_delta p;
p.y <- y;
refresh p
let update_z p z =
add_delta p;
p.z <- z;
refresh p
The duplication is starting to bug me because I want to write something like this:
let update_scalar p scalar value =
add_delta p;
magic_reflection (p, scalar) <- value;
refresh p
This way when I update x I can simply call:
update_scalar p 'x' value
This calls out "macros!" to me but I don't believe OCaml has a macro system. What else can I do?