 (defn bind-linear
   "The value of ref1 at address1 and the value of ref2 at address2
    are linked, so that if one changes, then the other chnages to
-   maintain value2 == (+ offset (* factor value1))."
+   maintain (== value2 (+ offset (* factor value1)))."
   [[ref1 address1] [factor offset] [ref2 address2]]
   (follow-linear [ref1 address1] [factor offset] [ref2 address2])
   (follow-linear [ref2 address2] [(/ factor) (- (/ offset factor))] [ref1 address1]))

                 [factor offset]
                 [ref2 address2])))

(defn bind-map [[ref1 address1] m [ref2 address2]]
  (let [m-inverse (clojure.set/map-invert m)]
    (bind-function [ref1 address1] m m-inverse [ref2 address2])))


  (follow [ref1 address1] [ref2 address2])
  (follow [ref2 address2] [ref1 address1]))

(defn unbind
  "The binding relationship between address1 in ref1 and
   address2 in ref2 is ended."
  [[ref1 address1] [ref2 address2]]
  (unfollow [ref1 address1] [ref2 address2])
  (unfollow [ref2 address2] [ref1 address1]))
