Data Translation through Views

Given two application types, each of which can be viewed as the same abstract type, a procedure to translate between them can be created.


(transfer-by-view 'ls2 'ls1)

(GLAMBDA ((VAR-LS1 LS1))
  (LET ((VAR-LS1-VIEW (LINE-SEGMENT VAR-LS1)))
    (A LS2 LEFT  (P1X VAR-LS1-VIEW)
           RIGHT (P2X VAR-LS1-VIEW)
           ANGLE (PHI VAR-LS1-VIEW)
           UP    (P2Y VAR-LS1-VIEW))))

(LAMBDA (VAR-LS1)
 (LET ((VAR-LS1-VIEW VAR-LS1))
  (LIST 'LS2
   (- (FIFTH VAR-LS1-VIEW)
      (* (THIRD VAR-LS1-VIEW) (COS (FOURTH VAR-LS1-VIEW))))
   (FIFTH VAR-LS1-VIEW)
   (- 1.5707963267948966 (FOURTH VAR-LS1-VIEW))
   (+ (* (THIRD VAR-LS1-VIEW) (SIN (FOURTH VAR-LS1-VIEW)))
      (SECOND VAR-LS1-VIEW)))))

Contents    Page-10    Prev    Next    Page+10    Index