<div dir="ltr"><div><div><div>Indeed, the notion of dimension is not really what I was after. My intention was rather to provide a useful unit converter.<br></div><div>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 <a href="http://m.kg">m.kg</a>.<br>
</div>Currently it does not support compound units for automatic conversions, but that's something I want to do anyway (just don't know when).<br><br></div>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:<br>
> (measure->value<br> (convert* '(52.8 ft (s -1))<br> '(mi h)))<br>'(36.0 mi (h -1))<br><br><br></div>Laurent<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Oct 26, 2013 at 6:42 PM, Konrad Hinsen <span dir="ltr"><<a href="mailto:konrad.hinsen@fastmail.net" target="_blank">konrad.hinsen@fastmail.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Laurent writes:<br>
<br>
> Examples and details here:<br>
> <a href="https://github.com/Metaxal/measures" target="_blank">https://github.com/Metaxal/measures</a><br>
<br>
</div>At first glance, I miss the notion of "dimension", which defines if<br>
two units are compatible, i.e. can be converted. If I understand your<br>
approach correctly (which I am not sure about), you consider each<br>
product of unit symbols as distinct. That means if someone enters a<br>
pressure in Pascal, and multiplies by an area in square meters, the<br>
result cannot be added to a force in Newton, although a Pascal is by<br>
definition a Newton per square meter.<br>
<br>
BTW, I can offer my Clojure units library for inspiration, if someone<br>
wants to implement a straightforward approach based on run-time checks:<br>
<br>
<a href="http://code.google.com/p/clj-units/" target="_blank">http://code.google.com/p/clj-units/</a><br>
<br>
It deals with dimension compatibility, and allows the definition of<br>
any number of unit systems. Like pretty much any library I know of, it<br>
doesn't handle the particularity of the SI system of having distinct<br>
incompatible units with equal dimension, such as Bq (Bequerel) and Hz<br>
(Hertz), which are both 1/s but reserved for specific applications.<br>
My library will let you convert Hz to Bq without complaint.<br>
<span class="HOEnZb"><font color="#888888"><br>
Konrad.<br>
</font></span><div class="HOEnZb"><div class="h5">____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div>