No, you can't do what you want in plain OCaml. You could write a syntax extension with camlp4 (which is a kind of a macro system, though a different kind than you're probably accustomed to) that would transform UPDATE_FIELD x f y into x. F For information about the latest version, see the OCaml tutorial site.
No, you can't do what you want in plain OCaml. You could write a syntax extension with camlp4 (which is a kind of a macro system, though a different kind than you're probably accustomed to) that would transform UPDATE_FIELD x f y into x. F NOTE: The version of camlp4 included in OCaml version 3.10 and later is different than and incompatible with the previous version.
For information about the latest version, see the OCaml tutorial site.
Nit: chosing val as an identifier name is confusing, val is used as a binding in module types. – Yttrill Jan 22 at 14:41 Fair enough. Changed it.
– Chris Conway Jan 22 at 20:17.
You can't do quite what you want, but you can greatly reduce the boilerplate with a higher-order function: let update_gen set p x = add_delta p; set p x; refresh p let update_x = update_gen (fun p v -> p. X p. Y p.Z.
Nice solution.. – Yttrill Jan 22 at 14:43.
As noted above ocaml has macro system. And for this task only small fraction of it is needed : open Printf type t = { mutable x : float; mutable y : float; mutable z : float; mutable t : int; } let add_delta p = p. T add_delta p; p.
X ; t = 0; } in update_x p 0.1; update_y p 0.3; update_z p 2.0 Compile with: ocamlfind ocamlc -package camlp4. Macro -syntax camlp4o q. Ml -o q See the generated code with : camlp4o Camlp4MacroParser. Cmo q.ml.
No, you can't do what you want in plain OCaml. Alternatively, you could stuff things into a hash table and forgo type safety. NOTE: The version of camlp4 included in OCaml version 3.10 and later is different than and incompatible with the previous version.
For information about the latest version, see the OCaml tutorial site.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.