impc:ti:check-to-update-generic-vars   scheme

Defined in:


;; this function is here to support type-unify
;; in the following way:
;; when going through type-unify it is possible
;; for a situation to arrise where a unification
;; over something like this may occur:
;; (("%list--3834748* (112 !head##829 list*##829"))
;; the result for the unification will be "%list-3834748*"
;; check-to-update-generic-vars is here to do a quick
;; check of the (112 !head##829 list*##829) to update
;; any possible vars (such as !head##829) which could get
;; useful information from the "%list--3834748*" before
;; they get thrown away.
(define impc:ti:check-to-update-generic-vars
  (lambda (atom lists vars)
    ;; (println 'checktoupdategenericvars: atom 'lists lists 'vars: vars)
    (let ((atom-type (if (string? atom)
                         (impc:ti:get-namedtype-type atom)
      ;; (println 'atom: atom 'atom-type atom-type 'lists lists)
      (if (list? atom-type)
          (map (lambda (e)
                 ;; (println 'type-match: atom-type 'against e)
                 (if (and (list? e)
                          (= (length e) (length atom-type)))
                     (if (and (number? (car e))
                              (number? (car atom-type))
                              (= (car e) (car atom-type)))
                         (map (lambda (a b)
                                (if (and (symbol? a)
                                         (assoc-strcmp a vars))
                                      (impc:ti:update-var a vars '() b))))
                              (cdr e)
                              (cdr atom-type)))))

Back to Index