Misc Functions¶
Additional utilities
-
proc
min
(x, y ...)¶ Compute the minimum value of 2 or more arguments using the
<
operator for comparison. If one of the arguments isMath.NAN
, the result is also NAN.
-
proc
max
(x, y ...)¶ Compute the maximum value of 2 or more arguments using the
>
operator for comparison. If one of the arguments isMath.NAN
, the result is also NAN.
-
proc
isCoercible
(type from, type to) param¶ Returns true if the type from is coercible to the type to, or if
isSubtype(from, to)
would return true.
-
proc
isSubtype
(type sub, type super) param¶ Returns true if the type sub is a subtype of the type super. In particular, returns true in any of these cases:
- sub is the same type as super
- sub is an instantiation of a generic type super
- sub is a class type inheriting from super
Note that
isSubtype(a,b)
can also be written asa <= b
orb >= a
.
-
proc
isProperSubtype
(type sub, type super) param¶ Similar to
isSubtype
but returns false if sub and super refer to the same type.Note that
isProperSubtype(a,b)
can also be written asa < b
orb > a
.
-
proc
<
(type a, type b) param¶ Returns: isProperSubtype(a,b)
-
proc
<=
(type a, type b) param¶ Returns: isSubtype(a,b)
-
proc
>
(type a, type b) param¶ Returns: isProperSubtype(b,a)
-
proc
>=
(type a, type b) param¶ Returns: isSubtype(b,a)