A domain tells Vex which values belong to it and which ops they have. The tables below come from the domain objects of @mark1russell7/vex-domains, at the time of the build. Thus the tables and the code are the same.
parameters: the kinds of the arguments after the receiver. The interpreter checks them, and an argument of the wrong kind gives #VALUE!. “not checked” means that the op does not declare its parameters.
laws: the claims of the op. The law checker of @mark1russell7/vex-testkit tests each claim with random values. Refer to the law arena.
lifts numbers: a number argument becomes a domain value with fromScalar. For example, add(5) adds the vector (5, 5).
identity: the value that reduce gives for an empty list.
implementation: method calls the method of the value with the same name. fn calls a function of the domain.
A LocalDate is a day of the calendar, without a time and without a time zone. It keeps the count of days since 1970-01-01. Thus a date plus a number is a later date, and a date minus a date is a count of days. The op date of NumDomain makes a date from a year, a month and a day. A month or a day outside its range rolls over, like DATE of a spreadsheet.
QuantityDomain of the entry @mark1russell7/vex-domains/quantity reads amounts in units as plain data, for example { value: 155, unit: "mm" }. The package @mark1russell7/quantity converts each amount exactly. Thus lte of 155 mm and 16 cm is true, and a sum of 0.1 m and 0.2 m is 0.3 m. add, subtract, min and max give the result in the unit of the receiver. Two amounts of different kinds give #CALC! with the reason. Put QuantityDomain before JsonDomain.
JsonDomain reads JSON data, for example the documents of a database. It accepts texts, finite numbers, booleans, arrays and plain objects. Put it last in the list of domains. Then add and eq go to the domains of numbers and texts first. kind gives the kind of a value. kinds gives the kind of each item or field, with "null" for null. fields gives the keys of an object, and field gives the value of one key.
leaves(o, depth) gives the leaves of the object o as a list of records with a path, a kind and a value. The walk goes into an object with fields while the path has fewer than depth keys. The schema pilot of @vex/pilots uses these ops. Its program gives one record for each field path of the documents, with the distinct kinds and the count of the documents with the path.