[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Engineering numbers and measures
Today, we copied a system to handle engineering numbers and measures to
cambridge.apple.com:/pub/mcl2/contrib. The system can be found in the file
measures.sea.hqx (you can also take measures.tar).
Example:
(in-package :cl-user)
(use-package 'measures)
(define-unit |m|
:base length
:metric)
(define-unit |qm| |m| |m|
:base area)
(define-unit |qkm| |km| |km|)
(define-unit |ar| 100 |qm|)
(define-unit |ha| 100 |ar|)
(define-unit |m3| |m| |m| |m| :base volume)
(define-unit |ccm| |cm| |cm| |cm|)
(define-unit |l| 1000 |ccm|)
(define-unit |s| :base time)
(define-unit |min| 60 |s|)
(define-unit |h| 60 |min|)
(define-unit |ms| 0.001 |s|)
(define-unit |m/s| |m| |/s| :base speed)
(define-unit |km/h| |km| |/h|)
(define-unit DM :base currency)
(define-unit |Pfg| 0.01 DM)
(define-unit $ 1.85 DM)
(define-unit |c| 0.01 $)
(define-unit-format time :step |h| |min| |s|)
(define-unit-format speed :unit |km/h|)
(define-unit-format length :base)
#|
? (dim+ 1m 4mm)
1.004m
? (dim* 1m 4mm)
0.004qm
? (dim- 1m 4mm)
0.996m
? (dim/ 1m 4mm)
250
? (dim/ 10m 3s)
12km/h
|#
The code has been tested (to some extent :-)
in Allegro CL 4.1, Harlequin CL 3.1.1, Macintosh CL 2.0p2, and Symbolics CL 8.1.
Please send suggestions or questions to moeller@informatik.uni-hamburg.de
Ralf & Roman
========================================
Ralf Moeller
University of Hamburg
Bodenstedtstr. 16
2000 Hamburg 50
Germany
Phone: ++40 4123 6134
Fax ++40 4123 6530
Email: moeller@informatik.uni-hamburg.de