[racket] Numbers with dimensions

From: Laurent (laurent.orseau at gmail.com)
Date: Sun Oct 27 09:32:06 EDT 2013

Indeed, the notion of dimension is not really what I was after. My
intention was rather to provide a useful unit converter.
If my current units are in N, and I multiply by square seconds, I think
it's not always desirable for the measure to be automatically converted to
Currently it does not support compound units for automatic conversions, but
that's something I want to do anyway (just don't know when).

It now supports more useful conversions, in particular from non-SI to
non-SI (as long as an intermediate SI unit can be used), for example:
> (measure->value
   (convert* '(52.8 ft (s -1))
             '(mi h)))
'(36.0 mi (h -1))


On Sat, Oct 26, 2013 at 6:42 PM, Konrad Hinsen
<konrad.hinsen at fastmail.net>wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131027/7dca2718/attachment.html>

Posted on the users mailing list.