impc:ti:unify   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;; unify is a little bit ugly
;; 1st it expands all symbols - during this process vars can be modified (force-var, update-var)
;; 2nd because var can change we check result against var to see if any change to var has improved things
;; 3rd because step 2 may have made changes for the better we should do a final symbol check
;; basically means going through the final result list to see if any symbols left in complex
;; types can be given types.
(define impc:ti:unify
  (lambda (vars)
    ;; (println 'unifyvars: vars)
    (let ((result (map (lambda (v)
                         ;;(println 'unify-v: v)
                         (let* ((sym (car v))
                                ;;(kkkkkk (println 'sym sym))
                                ;; expand any symbols and do reverse symbol checks
                                ;; (types-expanded (map (lambda (t)
                                ;;                        ;; first CLEAN the type (remove extraneous lists)
                                ;;                        (set! t (impc:ti:type-clean t))
                                ;;                        (if (or (symbol? t)
                                ;;                                (list? t))
                                ;;                            (let ((res (impc:ti:symbol-expand t vars (cdr v))))
                                ;;                              (set! res (impc:ti:type-clean res))
                                ;;                              res)
                                ;;                            t))
                                ;;                      (cdr v)))
                                ;; (kkkkkkkk (println 'unify-v-expanded: v 'expanded: types-expanded))
                                ;; (types-unified types-expanded)) ;(impc:ti:sym-unify sym types-expanded vars)))
                                (types-unified (impc:ti:sym-unify sym (cdr v) vars)))
;                                (types-unified (impc:ti:sym-unify sym types-expanded vars)))


Back to Index

Similar Entries