[racket] Units/measures library

From: Richard Cleis (rcleis at mac.com)
Date: Thu Nov 17 10:29:01 EST 2011

I vaguely remember seeing a Frink paper at LL4 (lightweight Languages 4). I think it even works.

It would be nice to be able to do something like:

(define-km d-km ...)
(define-ft d-ft ...) 
(define-secs t-secs ...) 
etc.

then be able to use functions like

(f-of-dees-and-t  v-km d-ft t-secs) where the units of the args don't matter. That seems TRish. For efficiency, blatant conversion functions are needed... or maybe a smart compiler. 

I think a billion-dollar Mars craft was lost over stuff like this.

rac

On Nov 17, 2011, at 8:10 AM, Matthias Felleisen wrote:

> 
> On Nov 17, 2011, at 8:41 AM, Jos Koot wrote:
> 
>> That should not be too difficult. I think of:
>> 
>> Temperatures: Celcius, Fharenheit, Kelvin
>> Distance: Meters, kilometers, land miles, nautic miles, lightyear nand so
>> on.
>> Mass: grams, kilograms, tons, slugs, and so on.
>> Weight: grams, kilograms, ounces, pounds, and so on.
>> Force: Newton, dyne, etc.
>> Energy: Joule, Erg, etc.
>> May be more.
>> 
>> This is easy to do.
>> Most work will be looking up references to physical units.
>> If no such library exists, I am willing to prepare a function like:
>> (unit-conversion from-unit to-unit from-number) -> to-number
>> Where from-unit and to-unit are two symbols naming units of the same
>> physical dimension.
> 
> 
> You may actually consider consuming real names instead of symbols 
> so that people can write expressions such as 
> 
> (convert 1/2 m ft)
> (convert 212 f c)
> (convert (sqrt i) g on) ; (I don't know the abbreviation for ounce)
> 
> -- Matthias
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.