No, I donโt think you can leave things undefined. Uninitialized values โโcause all sorts of problems in languages โโlike C, so avoid this in OCaml. (Although there are several functions in the standard library that leave some things undefined, such as String.create , I donโt think you can do it yourself.)
You will either have to fill in all the fields yourself (and use an empty list [] , or something similar for values โโthat you donโt need), or use a pre-existing value of this type and use write update syntax to create a new record with the fields that you interested, and others copied from a pre-existing record.
source share