14 name "coordinate type" / instantiate (method (xcoord ycoord) (class this (tolist xcoord ycoord))) / distance ;; this allows you to do things like (call {#21 '(1 2)} distance {#21 '(9 4)}) ;; ... it looks more elegant when the values are saved to symbols, since you ;; can then say (coordinate:distance other-coordinate) (method (this-val to-coord) (if (and (= (typeof (typeof to-coord)) 'OBJECT) (= (typeof to-coord) this)) (to-coord:distance-private (index 1 this-val) (index 2 this-val)) (raise E_PERM "Invalid attempt to find distance to non-coordinate value"))) / distance-private ;; this is the private implementation of 'distance' ... the end-user should ;; never call it. (method (this-val to-x to-y) (if (= caller this) (square-root (+ (square (- to-x (index 1 this-val))) (square (- to-y (index 2 this-val))))) (raise E_PERM "distance-private is a private method to this object"))) / / /+++++++++++++++++++++++ end of object 21 ++++++++++++++++++++++++++++++++