[racket] Units/measures library

From: Eduardo Cavazos (wayo.cavazos at gmail.com)
Date: Sat Nov 26 10:50:51 EST 2011

> Is there a units/measures library with metres (m), kilometres (km) and
> so on?

My mpl libraries provide symbolic versions of the arithmetic operations. 
They don't provide any facility specifically designed for unit 
conversion, but you can do stuff like this:

> (vars m kg s)
> (let ((mass (+ (* 3 kg) (* 4 kg)))
         (acceleration (/ (* 5 m) (^ (* 6 s) 2))))
     (* mass acceleration))
(* 35/36 kg m (^ s -2))

> (define ft (* 0.3048 m))
> (define lb (* 0.45359237 kg))
> (define min (* 60 s))
> (define hour (* 60 min))
> (define km (* 1000 m))
> (define mile (* 1.609344 km))
> (/ (* 55 mile) hour)
(* 24.5872 m (^ s -1))

https://github.com/dharmatech/mpl
https://github.com/dharmatech/mpl/blob/master/mpl.org

Ed


Posted on the users mailing list.