nanomath/src/boolean
Glen Whitney 686cd93927
All checks were successful
/ test (pull_request) Successful in 17s
feat: more utility functions
Adds type constants zero and one, and allows you to obtain them
   directly from a type object. This facility creates a behavior
   with a parametric type: the type of `math.zero(T)` where `T` is a
   Type object (i.e., has type `TypeOfTypes`) depends not just on that
   type TypeOfTypes, but instead on the _value_ of the argument `T`. Since
   nanomath is not (yet?) equipped to handle typing such a method, we just
   set its return type to a new constant NotAType that (hopefully) does not
   work with the rest of the type system. Also allows you to compute `zero`
   and `one` from an example value, rather than from the type object itself.

   Adds utility function `isZero` to test if a value is zero.

   As usual so far, the additions uncovered some remaining bugs, which
   this PR fixes. For example, there was a problem in that resolution of
   the `one` method was failing because the `Any` pattern was blocking
   matching of the `TypeOfTypes` pattern. Although we may eventually need to
   sort the patterns for a given method to maintain a reasonable matching
   order, for now the solution was just to move the two patterns into the
   same source file and explicitly order them. (With the way onType and
   Implementations are currently implemented, the proper ordering is more
   general to more specific, i.e. later implementations supersede earlier
   ones.

   Adds many new tests, as always.
2025-04-15 16:23:55 -07:00
..
__test__ feat: Introduce BooleanT and boolean functions (#17) 2025-04-13 16:29:51 +00:00
all.js feat: Introduce BooleanT and boolean functions (#17) 2025-04-13 16:29:51 +00:00
BooleanT.js feat: more utility functions 2025-04-15 16:23:55 -07:00
type.js feat: Introduce BooleanT and boolean functions (#17) 2025-04-13 16:29:51 +00:00