Laurent writes:

 > Examples and details here:
 > https://github.com/Metaxal/measures

At first glance, I miss the notion of "dimension", which defines if
two units are compatible, i.e. can be converted. If I understand your
approach correctly (which I am not sure about), you consider each
product of unit symbols as distinct. That means if someone enters a
pressure in Pascal, and multiplies by an area in square meters, the
result cannot be added to a force in Newton, although a Pascal is by
definition a Newton per square meter.

BTW, I can offer my Clojure units library for inspiration, if someone
wants to implement a straightforward approach based on run-time checks:

  http://code.google.com/p/clj-units/

It deals with dimension compatibility, and allows the definition of
any number of unit systems. Like pretty much any library I know of, it
doesn't handle the particularity of the SI system of having distinct
incompatible units with equal dimension, such as Bq (Bequerel) and Hz
(Hertz), which are both 1/s but reserved for specific applications.
My library will let you convert Hz to Bq without complaint.

Konrad.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to