anchor.diff:  
   
   
  -;;; % Geometry
  -
  -(defgeneric scalar-measurement (instance))
  -
  -(defclass* scalar ()
  -  ((measurement measurement)))
  -
  -
  -
  +;;; % Geometry Domain
  +
  +
  +(defclass scalar (measurement) ;; a monadic coordinate
  +  ())
  +
  +
  +;; (defclass plane ...)
  +;; (defclass space ...)
  +;;
  +;; The term "Coordinate" will be applied informaly, in the following
  +;;
  +;; (defclass diadic-coordinate ...) ;; a <point> onto a <planar surface>
  +;; (defclass triadic-coordinate ...) ;; a <point> onto <3 space>
  +;; (defclass polar-coordinate ...) 
  +;; ^ a <point> within a <polar coordinate> system  on a <planar surface>
  +;; (defclass spherical-coordinate ...)
  +;; ^ a <point> within a <spherical coordinate space>
  +
  +
  +
  
positive.code: 
  (in-package #:cl-user)
  
  (eval-when (:compile-toplevel :load-toplevel :execute)
  
  
negative.code: ;; (prefix-of (make-measurement 1 :m 24))
  ;; => <<yotta>>
  
  ;; (prefix-of (make-measurement 1 :m 23))
  ;; --> error
  
  ;; Trivial decimal exponential mathematics, ad hoc syntax:
  ;;
  ;;  1 m => 1000 mm
  ;;      => 0.001 km
  ;;
  ;; syntax: 
  ;;   (<magnitude>, <degree>)
  ;;   <A> =[<decimal shift>]=> <B>
   ;;  <=>   i.e. "equivalent to"
  ;; 
  ;; (1, 0) =[3]=> (.001, 3) <=> (1 * 10^-3, 3)
  ;; (1, 0) =[-3]=> (1000, -3) <=> (1 * 10^3, -3)
  ;;
  ;; e.g in a conventional syntax
  ;;  1 m = .001 km
  ;;  1 m = 1000 mm
  
  #+NIL ;; algorithm test
  ;; 1. define an implicit measurment instance via LET
  ;;
  ;; 2. return values representative of the original implicit
  ;;    measurement instance, as "decimal shifted" for a new decimal
  ;;    prefix degree
  ;;
  (let ((magnitude 1)
        (degree 0)
        (factor-base 10))
    (flet ((decimal-shift (new-degree)
             (cons (* magnitude (expt factor-base (- degree new-degree)))
                   (+ degree new-degree))))
      (values (decimal-shift 3)
              (decimal-shift -3))))
    
  
  (defun shift-magnitude (magnitude degree new-degree 
                          &optional (factor-base #.%factor-base%))
    ;; utility function - implementation of the "decimal shift"
    ;; algorithm denoted in the above
    (declare (type real magnitude)
             (type fixnum degree new-degree factor-base))
    (values (* magnitude (expt factor-base (- degree new-degree)))
            (+ degree new-degree)))
  
  (defmethod rescale ((scalar measurement) (prefix fixnum))
    (multiple-value-bind (new-mag new-deg) 
        (shift-magnitude (measurement-magnitude scalar)
                         (prefix-degree scalar)
                         prefix
                         #.%factor-base%)
      (make-measurement new-mag  (class-of scalar)
                        new-deg)))
  
  (defmethod rescale ((scalar measurement) (prefix prefix))
    (rescale scalar (prefix-degree prefix)))
  
  
  
  (defmethod nrescale ((scalar measurement) (prefix fixnum))
    (multiple-value-bind (new-mag new-deg) 
        (shift-magnitude (measurement-magnitude scalar)
                         (prefix-degree scalar)
                         prefix
                         #.%factor-base%)
      (setf (measurement-degree scalar) new-deg)
      (setf (measurement-magnitude scalar) new-mag)
      (values scalar)))
  
  (defmethod nrescale ((scalar measurement) (prefix prefix))
    (nrescale scalar (prefix-degree prefix))
    (values scalar))
  
  #+NIL ;; instance test - rescale, equivalent magnitude
  (let* ((m (make-measurement 1 :m))
         (m-2 (rescale m 3))
         (m-3 (rescale m -3)))
    (values m m-2 m-3
            (apply #'= (mapcar #'scalar-magnitude 
                               (list m m-2 m-3)))))
  ;; => #<METER 1 m {1006330FD3}>, 
  ;;    #<METER (1/1000)E+3 km {1006331AF3}>, 
  ;;    #<METER 1000E-3 mm {1006332293}>, 
  ;;    T 
  
  
  
  #+NIL ;; instance test - nrescale
  (let* ((m (make-measurement 1 :m))
         (m-2 (nrescale m 3)))
    (values m-2 (eq m-2 m)))
  
  ;; => #<METER (1/1000)E+3 km {1005F4C4D3}>, 
  ;;    T
  
  
  
  
  ;;; % DERIVED MEASUREMENT UNITS
  
  
  ;;; referencing http://physics.nist.gov/cuu/pdf/sp811.pdf
  ;; ... define measurement-classes, conversion matrices
  
  
  
  