Contents    Page-10    Prev    Next    Page+10    Index   

Unification Code ...


; unify lists of arguments
; lists must be of same length
(defn unifyc [args1 args2 subs]
  (if (empty? args1)
      (if (empty? args2)
          subs)   ; return subs, else fail
      (and args2 subs
       (let [newsubs (unifyb (first args1)
                        (first args2) subs)]
         (if newsubs
             (unifyc (sublis newsubs (rest args1))
                     (sublis newsubs (rest args2))
                     newsubs))) ) ) )