impc:ti:sym-unify   scheme


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

Implementation

(define impc:ti:sym-unify
  (lambda (sym types vars)
    ;; if sym is a !bang symbol and has no type set
    ;; then we trawl through vars looking for reified
    ;; types which we might be able to match it against.
    (if (and (null? types)
             (regex:match? (symbol->string sym) "^!"))
        (let ((gtd (impc:ti:generic-type-details sym)))
          (map (lambda (k)
                 (if (and (not (null? (cdr k)))
                          (impc:ir:type? (cadr k)))
                     (let ((gtd2 (impc:ti:generic-type-details (car k))))
                       (if (and gtd2 (= (cadr gtd) (cadr gtd2)))
                           (let ((val (impc:ti:check-bang-against-reified sym (car k) vars)))
                             (if val
                                 (begin
                                   (impc:ti:update-var sym vars '() val))))))))
               vars)))


Back to Index