Skip to content

The domains

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.
Vec239 ops · fromScalar · valid · encode/decode
opparameterslawslifts numbersidentityimplementation
adddomaincommutative, associativeyesyesmethod
subtractdomainyesmethod
multiplydomaincommutative, associativeyesyesmethod
dividedomainyesmethod
mindomaincommutative, associative, idempotentyesmethod
maxdomaincommutative, associative, idempotentyesmethod
scalenumbermethod
negatenot checkedmethod
halvenot checkedmethod
absnot checkedmethod
roundnot checkedmethod
floornot checkedmethod
ceilnot checkedmethod
clampnumber, numbermethod
swapnot checkedmethod
rotatenumbermethod
normalizenot checkedmethod
lerpdomain, numbermethod
lengthnot checkedmethod
lengthSqnot checkedmethod
distancedomainmethod
dotdomaincommutativemethod
crossdomainmethod
anglenot checkedmethod
areanot checkedmethod
sumnot checkedmethod
minComponentnot checkedmethod
maxComponentnot checkedmethod
equalsdomaincommutativemethod
anyNonPositivenot checkedmethod
allPositivenot checkedmethod
anyNegativenot checkedmethod
allNonNegativenot checkedmethod
anyZeronot checkedmethod
allZeronot checkedmethod
anyLessThannumbermethod
allLessThannumbermethod
anyGreaterThannumbermethod
allGreaterThannumbermethod
NDVector15 ops · valid · encode/decode
opparameterslawslifts numbersidentityimplementation
adddomaincommutative, associativeyesmethod
subtractdomainmethod
multiplydomaincommutative, associativemethod
mergePreferNonZerodomainassociative, idempotentmethod
scalenumbermethod
clampnumber, numbermethod
dotdomaincommutativemethod
lengthnot checkedmethod
norm1not checkedmethod
normInfnot checkedmethod
equalsdomaincommutativemethod
picknot checkedmethod
withKeysnot checkedmethod
getstringmethod
setstring, numbermethod
NDVector(lifted)15 ops · fromScalar · valid
opparameterslawslifts numbersidentityimplementation
adddomaincommutative, associativeyesyesmethod
subtractdomainyesmethod
multiplydomaincommutative, associativeyesmethod
mergePreferNonZerodomainassociative, idempotentmethod
scalenumbermethod
clampnumber, numbermethod
dotdomaincommutativeyesmethod
lengthnot checkedmethod
norm1not checkedmethod
normInfnot checkedmethod
equalsdomaincommutativemethod
picknot checkedmethod
withKeysnot checkedmethod
getstringmethod
setstring, numbermethod
NumRecord1 ops
opparameterslawslifts numbersidentityimplementation
toNDVectornot checkedfn
Color6 ops · fromScalar · valid · encode/decode
opparameterslawslifts numbersidentityimplementation
adddomaincommutative, associativeyesmethod
multiplynumbermethod
clampnumber, numbermethod
mixdomain, numbermethod
luminancenot checkedmethod
equalsdomaincommutativemethod
Angle8 ops · fromScalar · valid · encode/decode
opparameterslawslifts numbersidentityimplementation
adddomaincommutative, associativeyesyesmethod
subtractdomainyesmethod
scalenumbermethod
normalizenot checkedmethod
toVec2numbermethod
sinnot checkedmethod
cosnot checkedmethod
degreesnot checkedmethod
Num20 ops · valid
opparameterslawslifts numbersidentityimplementation
addnumbercommutative, associativeyesfn
subtractnumberfn
multiplynumbercommutative, associativeyesfn
dividenumberfn
modnumberfn
pownumberfn
minnumbercommutative, associative, idempotentfn
maxnumbercommutative, associative, idempotentfn
clampnumber, numberfn
absnot checkedfn
negatenot checkedfn
sqrtnot checkedfn
floornot checkedfn
ceilnot checkedfn
roundnot checkedfn
gtnumberfn
gtenumberfn
ltnumberfn
ltenumberfn
eqnumbercommutativefn
Bool5 ops
opparameterslawslifts numbersidentityimplementation
andbooleancommutative, associative, idempotentyesfn
orbooleancommutative, associative, idempotentyesfn
xorbooleancommutative, associativeyesfn
notnot checkedfn
eqbooleancommutativefn
Fn1 ops
opparameterslawslifts numbersidentityimplementation
invokenot checkedmethod
Maybe5 ops
opparameterslawslifts numbersidentityimplementation
isTopnot checkedmethod
isBottomnot checkedmethod
mapnot checkedmethod
chainnot checkedmethod
valueOrnot checkedmethod