clojure.lang.Numbers combines 3 things:

  1. a set of type based rules for math
  2. information about types
  3. actually implementations of the methods require for #1

an example of #1 is "if any args are floating point, the result is floating point" but this knowledge is spread through out a number of methods, and is only derivable if you know which types are floating point and work backwards from there.

A nicer approach would be to encode #1 as actually rules written up in core.logic, #2 as a database of information about types for a specific platform. I think #3 can also be generated from #1 and #2 but I am on shakier ground there.

From this approach we can use the rules with a different database of type information to generate a math runtime for a different platform (like the clr? beam?).

A possible fall out from this is generating a more consistent set of compiler intrinsics for math operations.